view CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcbcf.c @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
line wrap: on
line source
/* Generated by Cython 3.0.11 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "BUILDING_WHEEL",
                null
            ]
        ],
        "depends": [
            "/project/htslib/htslib/bgzf.h",
            "/project/htslib/htslib/cram.h",
            "/project/htslib/htslib/faidx.h",
            "/project/htslib/htslib/hfile.h",
            "/project/htslib/htslib/hts.h",
            "/project/htslib/htslib/kstring.h",
            "/project/htslib/htslib/sam.h",
            "/project/htslib/htslib/tbx.h",
            "/project/htslib/htslib/vcf.h",
            "/project/htslib/htslib/vcfutils.h",
            "/project/pysam/htslib_util.h"
        ],
        "extra_compile_args": [
            "-Wno-unused",
            "-Wno-strict-prototypes",
            "-Wno-sign-compare",
            "-Wno-error=declaration-after-statement"
        ],
        "extra_link_args": [
            "-Wl,-rpath,$ORIGIN"
        ],
        "include_dirs": [
            "pysam",
            "/project/pysam",
            "/project/htslib",
            "/project/samtools",
            "/project/samtools/lz4",
            "/project/bcftools",
            "/project"
        ],
        "language": "c",
        "libraries": [
            "z",
            "lzma",
            "bz2",
            "z",
            "m",
            "curl",
            "crypto",
            "chtslib.cpython-37m-x86_64-linux-gnu",
            "cutils.cpython-37m-x86_64-linux-gnu"
        ],
        "library_dirs": [
            "/project/pysam",
            "/project",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/pysam",
            "build/lib.linux-x86_64-cpython-37/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 */
#if defined(CYTHON_LIMITED_API) && 0
  #ifndef Py_LIMITED_API
    #if CYTHON_LIMITED_API+0 > 0x03030000
      #define Py_LIMITED_API CYTHON_LIMITED_API
    #else
      #define Py_LIMITED_API 0x03030000
    #endif
  #endif
#endif

#include "Python.h"

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif
    

    #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 < 0x030700b1 || (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
    
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.7+ or Python 3.3+.
#else
#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
#else
#define __PYX_EXTRA_ABI_MODULE_NAME ""
#endif
#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
#define CYTHON_HEX_VERSION 0x03000BF0
#define CYTHON_FUTURE_DIVISION 1
#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_NOGIL 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
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3)
  #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_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #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_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3)
  #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_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
  #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
#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_NOGIL 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_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 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
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_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 0
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 1
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #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
#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #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
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #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 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS 0
  #endif
#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
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef 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
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || 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
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03050000
    #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
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #if PY_VERSION_HEX < 0x030400a1
    #undef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #elif !defined(CYTHON_USE_TP_FINALIZE)
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #if PY_VERSION_HEX < 0x030600B1
    #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)
  #endif
  #if PY_VERSION_HEX < 0x030700A3
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(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 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if !defined(CYTHON_VECTORCALL)
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
#endif
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #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
#  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
#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))

#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

#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_DefaultClassType PyClass_Type
  #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)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    static CYTHON_INLINE 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, "iiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOOiOO", 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;
    }
    #ifndef CO_OPTIMIZED
    #define CO_OPTIMIZED 0x0001
    #endif
    #ifndef CO_NEWLOCALS
    #define CO_NEWLOCALS 0x0002
    #endif
    #ifndef CO_VARARGS
    #define CO_VARARGS 0x0004
    #endif
    #ifndef CO_VARKEYWORDS
    #define CO_VARKEYWORDS 0x0008
    #endif
    #ifndef CO_ASYNC_GENERATOR
    #define CO_ASYNC_GENERATOR 0x0200
    #endif
    #ifndef CO_GENERATOR
    #define CO_GENERATOR 0x0020
    #endif
    #ifndef CO_COROUTINE
    #define CO_COROUTINE 0x0080
    #endif
#elif PY_VERSION_HEX >= 0x030B0000
  static CYTHON_INLINE 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;
    PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
    if (!empty_bytes) return NULL;
    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, empty_bytes);
    Py_DECREF(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
#endif
#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 CO_COROUTINE
  #define CO_COROUTINE 0x80
#endif
#ifndef CO_ASYNC_GENERATOR
  #define CO_ASYNC_GENERATOR 0x200
#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
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #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_MAJOR_VERSION >= 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) {
#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 < 0x030900B1
  #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_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_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()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
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;
}
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if PY_MAJOR_VERSION < 3
    #if CYTHON_COMPILING_IN_PYPY
        #if PYPY_VERSION_NUM < 0x07030600
            #if defined(__cplusplus) && __cplusplus >= 201402L
                [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
            #elif defined(__GNUC__) || defined(__clang__)
                __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
            #elif defined(_MSC_VER)
                __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
            #endif
            static CYTHON_INLINE int PyGILState_Check(void) {
                return 0;
            }
        #else  // PYPY_VERSION_NUM < 0x07030600
        #endif  // PYPY_VERSION_NUM < 0x07030600
    #else
        static CYTHON_INLINE int PyGILState_Check(void) {
            PyThreadState * tstate = _PyThreadState_Current;
            return tstate && (tstate == PyGILState_GetThisThreadState());
        }
    #endif
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && 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 PY_MAJOR_VERSION >= 3 && (!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)
  #define __Pyx_PyObject_GetIterNextFunc(obj)  (Py_TYPE(obj)->tp_iternext)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
  #define __Pyx_PyObject_GetIterNextFunc(obj)  PyIter_Next
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
#else
  #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
#endif
#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 CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GetLength(u)
  #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))
#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #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_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((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
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((int)sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
    #undef 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_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#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_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_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #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)
#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_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #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)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
  #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 PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define __Pyx_Py3Int_Check(op)       PyLong_Check(op)
  #define __Pyx_Py3Int_CheckExact(op)  PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#else
  #define __Pyx_Py3Int_Check(op)       (PyLong_Check(op) || PyInt_Check(op))
  #define __Pyx_Py3Int_CheckExact(op)  (PyLong_CheckExact(op) || PyInt_CheckExact(op))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_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

#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; }
#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>
#include <stddef.h>
#include "pythread.h"

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

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

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

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


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

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

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

static const char *__pyx_f[] = {
  "pysam/libcbcf.pyx",
  "contextvars.pxd",
  "array.pxd",
  "pysam/libcbcf.pxd",
  "<stringsource>",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

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

/* #### 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":112
 * 
 * 
 * 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":129
 * 
 * 
 * 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_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":15
 * # 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":16
 * 
 * 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":17
 * 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":29
 * ## 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":30
 * ########################################################################
 * 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":31
 * 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":32
 * 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":33
 * 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":34
 * 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;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "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":2321
 *         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":2346
 *         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":2351
 *             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":2465
 *                     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":2494
 *         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":2499
 *             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":2671
 *                     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":2738
 *         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":2756
 *                     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":2899
 *         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":2936
 *         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":2945
 *             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":3477
 *         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":3487
 *             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":3492
 *         # 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":3557
 *                 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":3586
 *         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":3591
 *             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":3701
 *         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":3706
 *             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":4033
 * 
 * 
 * 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;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
  #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
#endif
  #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);
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_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
#else
    #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
#endif
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
    #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
#else
    #define __Pyx_Arg_NewRef_VARARGS(arg) arg
    #define __Pyx_Arg_XDECREF_VARARGS(arg)
#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_Arg_FASTCALL(args, i) args[i]
    #define __Pyx_NumKwargs_FASTCALL(kwds) 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
    #define __Pyx_Arg_NewRef_FASTCALL(arg) arg  /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
                                                   to have the same reference counting */
    #define __Pyx_Arg_XDECREF_FASTCALL(arg)
#else
    #define __Pyx_Arg_FASTCALL __Pyx_Arg_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
    #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
    #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
#else
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* Profile.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_TRACE
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#ifndef CYTHON_PROFILE_REUSE_FRAME
  #define CYTHON_PROFILE_REUSE_FRAME 0
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #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
  #define __Pyx_TraceDeclarations\
      static PyCodeObject *__pyx_frame_code = NULL;\
      CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
      int __Pyx_use_tracing = 0;
  #define __Pyx_TraceFrameInit(codeobj)\
      if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
#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
  #ifdef WITH_THREAD
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, 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(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          }\
          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(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #else
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  {   PyThreadState* tstate = PyThreadState_GET();\
      if (__Pyx_IsTracing(tstate, 1, 1)) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #endif
  #define __Pyx_TraceException()\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 1)) {\
          __Pyx_EnterTracing(tstate);\
          PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
          if (exc_info) {\
              if (CYTHON_TRACE && tstate->c_tracefunc)\
                  tstate->c_tracefunc(\
                      tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              tstate->c_profilefunc(\
                  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              Py_DECREF(exc_info);\
          }\
          __Pyx_LeaveTracing(tstate);\
      }\
  }
  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
      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);
      CYTHON_FRAME_DEL(frame);
      __Pyx_LeaveTracing(tstate);
      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceReturn(result, 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, (PyObject*)result);\
              }\
              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);\
          }\
      }\
  }
  #else
  #define __Pyx_TraceReturn(result, nogil)\
  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);\
      }\
  }
  #endif
  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
#else
  #define __Pyx_TraceDeclarations
  #define __Pyx_TraceFrameInit(codeobj)
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceException()
  #define __Pyx_TraceReturn(result, nogil)
#endif
#if CYTHON_TRACE
  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
      int ret;
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_PyFrame_SetLineNumber(frame, lineno);
      __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;
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              int ret = 0;\
              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, lineno);\
              }\
              __Pyx_PyGILState_Release(state);\
              if (unlikely(ret)) goto_error;\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
              int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              if (unlikely(ret)) goto_error;\
          }\
      }\
  }
  #else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
          int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
          if (unlikely(ret)) goto_error;\
      }\
  }
  #endif
#else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
#endif

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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_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_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (1)
#elif 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 CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

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

/* 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 **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"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #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

/* 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 **args, size_t nargs, PyObject *kwargs);

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

/* 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)\
    (__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)\
    (__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)\
    (__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 */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);

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

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

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

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

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

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

/* 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 */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, 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_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 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, 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 PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyObject_Unicode.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
#else
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
#endif

/* py_dict_pop.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
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

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

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

/* RaiseClosureNameError.proto */
static CYTHON_INLINE 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);

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

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

/* IncludeStructmemberH.proto */
#include <structmember.h>

/* FixUpExtensionType.proto */
#if CYTHON_USE_TYPE_SPECS
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
#endif

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

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

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

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

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

/* MergeVTables.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type);
#endif

/* SetupReduce.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_setup_reduce(PyObject* type_obj);
#endif

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
#define __PYX_HAVE_RT_ImportType_proto_3_0_11
#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_0_11(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_0_11 {
   __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
};
static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size);
#endif

/* ImportDottedModule.proto */
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
#endif

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

/* FetchCommonType.proto */
#if !CYTHON_USE_TYPE_SPECS
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#else
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
#endif

/* PyMethodNew.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    typesModule = PyImport_ImportModule("types");
    if (!typesModule) return NULL;
    methodType = PyObject_GetAttrString(typesModule, "MethodType");
    Py_DECREF(typesModule);
    if (!methodType) return NULL;
    result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
    Py_DECREF(methodType);
    return result;
}
#elif PY_MAJOR_VERSION >= 3
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);
}
#else
    #define __Pyx_PyMethod_New PyMethod_New
#endif

/* PyVectorcallFastCallDict.proto */
#if CYTHON_METH_FASTCALL
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
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if PY_VERSION_HEX < 0x030500A0 || 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
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;
    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_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
#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 void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(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
#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 */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

/* 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 *);
#if PY_MAJOR_VERSION >= 3
    char *formats;
#endif
} 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;
#if PY_MAJOR_VERSION >= 3
        unsigned long long *as_ulonglongs;
        long long *as_longlongs;
#endif
        short *as_shorts;
        unsigned short *as_ushorts;
        Py_UNICODE *as_pyunicodes;
        void *as_voidptr;
    } data;
    Py_ssize_t allocated;
    struct arraydescr *ob_descr;
    PyObject *weakreflist;
#if PY_MAJOR_VERSION >= 3
        int ob_exports;
#endif
};
#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_PyInt_From_int(int value);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#else
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetName(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)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (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)

/* 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;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    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 PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
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);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

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

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

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

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

/* #### Code section: module_declarations ### */
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
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 "cpython.int" */

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

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

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

/* 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_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_chr;
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_A[] = "A";
static const char __pyx_k_G[] = "G";
static const char __pyx_k_R[] = "R";
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_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
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_gc[] = "gc";
static const char __pyx_k_gz[] = ".gz";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_wb[] = "wb";
static const char __pyx_k_wz[] = "wz";
static const char __pyx_k_ALT[] = "ALT";
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_REF[] = "REF";
static const char __pyx_k_SNP[] = "SNP";
static const char __pyx_k__12[] = "";
static const char __pyx_k__52[] = ".";
static const char __pyx_k__53[] = "\"";
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_chr[] = "chr";
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_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_rec[] = "rec";
static const char __pyx_k_ref[] = "ref";
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_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_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__181[] = ", ";
static const char __pyx_k__241[] = "-";
static const char __pyx_k__278[] = "*";
static const char __pyx_k__323[] = "_";
static const char __pyx_k__330[] = "?";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_bkey[] = "bkey";
static const char __pyx_k_ckey[] = "ckey";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_hash[] = "__hash__";
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_open[] = "open";
static const char __pyx_k_qual[] = "qual";
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_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_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_cmode[] = "cmode";
static const char __pyx_k_fetch[] = "fetch";
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_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_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_append[] = "append";
static const char __pyx_k_contig[] = "contig";
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_format[] = "format";
static const char __pyx_k_header[] = "header";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_length[] = "length";
static const char __pyx_k_name_2[] = "__name__";
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_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_sample[] = "sample";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
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_NON_REF[] = "<NON_REF>";
static const char __pyx_k_OVERLAP[] = "OVERLAP";
static const char __pyx_k_alleles[] = "alleles";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_disable[] = "disable";
static const char __pyx_k_dst_hdr[] = "dst_hdr";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_get_tid[] = "get_tid";
static const char __pyx_k_info_id[] = "info_id";
static const char __pyx_k_is_open[] = "is_open";
static const char __pyx_k_records[] = "records";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_src_hdr[] = "src_hdr";
static const char __pyx_k_threads[] = "threads";
static const char __pyx_k_BCFIndex[] = "BCFIndex";
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_endswith[] = "endswith";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_iterkeys[] = "iterkeys";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_reversed[] = "reversed";
static const char __pyx_k_setstate[] = "__setstate__";
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_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_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_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_startswith[] = "startswith";
static const char __pyx_k_BCFIterator[] = "BCFIterator";
static const char __pyx_k_Description[] = "Description";
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_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_BaseIterator[] = "BaseIterator";
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_parse_region[] = "parse_region";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_stringsource[] = "<stringsource>";
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_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_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_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_Invalid_filter[] = "Invalid filter: {}";
static const char __pyx_k_Invalid_header[] = "Invalid header";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
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_subset_samples[] = "subset_samples";
static const char __pyx_k_truncated_file[] = "truncated file";
static const char __pyx_k_unknown_format[] = "unknown format: {}";
static const char __pyx_k_BaseIndex_items[] = "BaseIndex.items";
static const char __pyx_k_VariantMetadata[] = "VariantMetadata";
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_unable_to_fetch[] = "unable to fetch {}:{}-{}";
static const char __pyx_k_BaseIndex_update[] = "BaseIndex.update";
static const char __pyx_k_BaseIndex_values[] = "BaseIndex.values";
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_check_truncation[] = "check_truncation";
static const char __pyx_k_invalid_contig_2[] = "invalid contig";
static const char __pyx_k_unsupported_type[] = "unsupported type";
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_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_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_BaseIndex_iterkeys[] = "BaseIndex.iterkeys";
static const char __pyx_k_Invalid_INFO_field[] = "Invalid INFO field: {}";
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_index_required[] = "bcf index required";
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_BaseIndex_iteritems[] = "BaseIndex.iteritems";
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_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_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_must_not_be_None[] = "bcf must not be None";
static const char __pyx_k_duplicate_filehandle[] = "duplicate_filehandle";
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_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_hdr_format_failed[] = "bcf_hdr_format failed";
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_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_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_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_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_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_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_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_invalid_number_of_columns[] = "invalid number of columns";
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_pyx_unpickle_VariantContig[] = "__pyx_unpickle_VariantContig";
static const char __pyx_k_unsupported_info_type_code[] = "unsupported info type code";
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_Invalid_header_record_index[] = "Invalid header record index";
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_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_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_pyx_unpickle_VariantMetadata[] = "__pyx_unpickle_VariantMetadata";
static const char __pyx_k_unsupported_header_type_code[] = "unsupported header type code";
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_could_not_open_variant_file_2[] = "could not open variant file `{}`";
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_BaseIterator___setstate_cython[] = "BaseIterator.__setstate_cython__";
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_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_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_Invalid_VariantRecord_Number_of[] = "Invalid VariantRecord.  Number of samples does not match header ({} vs {})";
static const char __pyx_k_Number_must_be_None_when_adding[] = "Number must be None when adding a filter";
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_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_self_ptr_cannot_be_converted_to[] = "self.ptr cannot be converted to a Python object for pickling";
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_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_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_VariantRecordSamp_2[] = "__pyx_unpickle_VariantRecordSample";
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_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*/
static __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type_split = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, 0, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type_format = {0, 0, 0, 0, 0};
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
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
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HTSFile;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  #endif
  PyTypeObject *__pyx_ptype_7cpython_5array_array;
  #if CYTHON_USE_MODULE_STATE
  #endif
  #if CYTHON_USE_MODULE_STATE
  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;
  #endif
  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;
  PyObject *__pyx_n_u_A;
  PyObject *__pyx_n_u_ALT;
  PyObject *__pyx_n_s_AssertionError;
  PyObject *__pyx_n_s_BCFIndex;
  PyObject *__pyx_n_u_BCFIndex;
  PyObject *__pyx_n_s_BCFIndex___reduce_cython;
  PyObject *__pyx_n_s_BCFIndex___setstate_cython;
  PyObject *__pyx_n_s_BCFIndex_fetch;
  PyObject *__pyx_n_s_BCFIterator;
  PyObject *__pyx_n_u_BCFIterator;
  PyObject *__pyx_n_s_BCFIterator___reduce_cython;
  PyObject *__pyx_n_s_BCFIterator___setstate_cython;
  PyObject *__pyx_n_u_BND;
  PyObject *__pyx_n_s_BaseIndex;
  PyObject *__pyx_n_u_BaseIndex;
  PyObject *__pyx_n_s_BaseIndex___reduce_cython;
  PyObject *__pyx_n_s_BaseIndex___setstate_cython;
  PyObject *__pyx_n_s_BaseIndex_get;
  PyObject *__pyx_n_s_BaseIndex_items;
  PyObject *__pyx_n_s_BaseIndex_iteritems;
  PyObject *__pyx_n_s_BaseIndex_iterkeys;
  PyObject *__pyx_n_s_BaseIndex_itervalues;
  PyObject *__pyx_n_s_BaseIndex_keys;
  PyObject *__pyx_n_s_BaseIndex_pop;
  PyObject *__pyx_n_s_BaseIndex_update;
  PyObject *__pyx_n_s_BaseIndex_values;
  PyObject *__pyx_n_s_BaseIterator;
  PyObject *__pyx_n_u_BaseIterator;
  PyObject *__pyx_n_s_BaseIterator___reduce_cython;
  PyObject *__pyx_n_s_BaseIterator___setstate_cython;
  PyObject *__pyx_n_u_CONTIG;
  PyObject *__pyx_kp_u_Cannot_add_extra_threads_when_ig;
  PyObject *__pyx_kp_u_Cannot_copy_arrays_with_src_valu;
  PyObject *__pyx_kp_u_Cannot_create_empty_array;
  PyObject *__pyx_kp_u_Cannot_re_open_htsfile;
  PyObject *__pyx_kp_u_Cannot_set_phased_before_genotyp;
  PyObject *__pyx_kp_u_Cannot_specify_an_index_filename;
  PyObject *__pyx_kp_u_Cannot_translate_record_Number_o;
  PyObject *__pyx_n_u_Description;
  PyObject *__pyx_kp_u_Duplicated_sample_name;
  PyObject *__pyx_n_b_END;
  PyObject *__pyx_n_u_END;
  PyObject *__pyx_kp_u_END_is_a_reserved_attribute_acce;
  PyObject *__pyx_kp_u_Error_extracting_ID;
  PyObject *__pyx_kp_u_Error_s_reading_record;
  PyObject *__pyx_kp_u_Error_unpacking_VariantRecord;
  PyObject *__pyx_kp_u_Error_updating_alleles;
  PyObject *__pyx_kp_u_Error_updating_id;
  PyObject *__pyx_n_u_FILTER;
  PyObject *__pyx_n_u_FIXED;
  PyObject *__pyx_n_u_FORMAT;
  PyObject *__pyx_n_u_Flag;
  PyObject *__pyx_kp_u_Flag_types_are_not_allowed_on_FO;
  PyObject *__pyx_kp_u_Flag_values_must_be_True_False_N;
  PyObject *__pyx_n_u_Float;
  PyObject *__pyx_n_u_G;
  PyObject *__pyx_n_u_GENERIC;
  PyObject *__pyx_n_u_GT;
  PyObject *__pyx_kp_u_Header_already_exists_for_contig;
  PyObject *__pyx_kp_u_Header_already_exists_for_id;
  PyObject *__pyx_n_u_ID;
  PyObject *__pyx_n_u_INDEL;
  PyObject *__pyx_n_u_INFO;
  PyObject *__pyx_n_s_IOError;
  PyObject *__pyx_kp_u_I_O_operation_on_closed_file;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6;
  PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7;
  PyObject *__pyx_n_s_IndexError;
  PyObject *__pyx_n_u_Integer;
  PyObject *__pyx_kp_u_Integer_value_too_small_large_to;
  PyObject *__pyx_kp_u_Invalid_INFO_field;
  PyObject *__pyx_kp_u_Invalid_VariantRecord_Number_of;
  PyObject *__pyx_kp_u_Invalid_allele_index;
  PyObject *__pyx_kp_u_Invalid_chromosome_contig;
  PyObject *__pyx_kp_u_Invalid_filter;
  PyObject *__pyx_kp_u_Invalid_header;
  PyObject *__pyx_kp_u_Invalid_header_id;
  PyObject *__pyx_kp_u_Invalid_header_record_index;
  PyObject *__pyx_kp_u_Invalid_index_object;
  PyObject *__pyx_kp_u_Invalid_tid;
  PyObject *__pyx_n_s_KeyError;
  PyObject *__pyx_n_u_MNP;
  PyObject *__pyx_n_s_MemoryError;
  PyObject *__pyx_kp_u_NON_REF;
  PyObject *__pyx_n_s_NotImplemented;
  PyObject *__pyx_n_u_Number;
  PyObject *__pyx_kp_u_Number_must_be_None_when_adding;
  PyObject *__pyx_n_u_OTHER;
  PyObject *__pyx_n_u_OVERLAP;
  PyObject *__pyx_kp_u_One_or_more_of_the_supplied_samp;
  PyObject *__pyx_n_u_PASS;
  PyObject *__pyx_n_s_PickleError;
  PyObject *__pyx_kp_u_Position_must_be_positive;
  PyObject *__pyx_n_u_R;
  PyObject *__pyx_n_u_REF;
  PyObject *__pyx_n_u_SNP;
  PyObject *__pyx_n_u_STRUCTURED;
  PyObject *__pyx_kp_u_Start_coordinate_must_be_non_neg;
  PyObject *__pyx_n_s_StopIteration;
  PyObject *__pyx_kp_u_Stop_coordinate_must_be_non_nega;
  PyObject *__pyx_kp_u_Stop_position_of_the_interval;
  PyObject *__pyx_n_u_String;
  PyObject *__pyx_n_s_TabixIndex;
  PyObject *__pyx_n_u_TabixIndex;
  PyObject *__pyx_n_s_TabixIndex___reduce_cython;
  PyObject *__pyx_n_s_TabixIndex___setstate_cython;
  PyObject *__pyx_n_s_TabixIndex_fetch;
  PyObject *__pyx_n_s_TabixIterator;
  PyObject *__pyx_n_u_TabixIterator;
  PyObject *__pyx_n_s_TabixIterator___reduce_cython;
  PyObject *__pyx_n_s_TabixIterator___setstate_cython;
  PyObject *__pyx_n_u_Type;
  PyObject *__pyx_n_s_TypeError;
  PyObject *__pyx_kp_u_Type_must_be_None_when_adding_a;
  PyObject *__pyx_kp_u_Unable_to_delete_END;
  PyObject *__pyx_kp_u_Unable_to_delete_FORMAT;
  PyObject *__pyx_kp_u_Unable_to_delete_INFO;
  PyObject *__pyx_kp_u_Unable_to_update_INFO_values;
  PyObject *__pyx_kp_u_Unable_to_update_format_values;
  PyObject *__pyx_kp_u_Unknown_INFO_field;
  PyObject *__pyx_kp_u_Unknown_allele;
  PyObject *__pyx_kp_u_Unknown_format_length;
  PyObject *__pyx_kp_u_Unsupported_FORMAT_type;
  PyObject *__pyx_kp_u_Unsupported_INFO_type;
  PyObject *__pyx_kp_u_Use_allele_indices_to_set_intege;
  PyObject *__pyx_n_u_VARIABLE;
  PyObject *__pyx_n_s_ValueError;
  PyObject *__pyx_n_s_VariantContig;
  PyObject *__pyx_n_u_VariantContig;
  PyObject *__pyx_n_s_VariantContig___reduce_cython;
  PyObject *__pyx_n_s_VariantContig___setstate_cython;
  PyObject *__pyx_n_s_VariantContig_remove_header;
  PyObject *__pyx_n_s_VariantFile;
  PyObject *__pyx_n_u_VariantFile;
  PyObject *__pyx_n_s_VariantFile___reduce_cython;
  PyObject *__pyx_n_s_VariantFile___setstate_cython;
  PyObject *__pyx_n_s_VariantFile_close;
  PyObject *__pyx_n_s_VariantFile_copy;
  PyObject *__pyx_n_s_VariantFile_fetch;
  PyObject *__pyx_n_s_VariantFile_get_reference_name;
  PyObject *__pyx_n_s_VariantFile_get_tid;
  PyObject *__pyx_n_s_VariantFile_is_valid_tid;
  PyObject *__pyx_n_s_VariantFile_new_record;
  PyObject *__pyx_n_s_VariantFile_open;
  PyObject *__pyx_n_s_VariantFile_reset;
  PyObject *__pyx_n_s_VariantFile_subset_samples;
  PyObject *__pyx_n_s_VariantFile_write;
  PyObject *__pyx_n_s_VariantHeader;
  PyObject *__pyx_n_u_VariantHeader;
  PyObject *__pyx_n_s_VariantHeaderContigs;
  PyObject *__pyx_n_u_VariantHeaderContigs;
  PyObject *__pyx_n_s_VariantHeaderContigs___iter;
  PyObject *__pyx_n_s_VariantHeaderContigs___reduce_cy;
  PyObject *__pyx_n_s_VariantHeaderContigs___setstate;
  PyObject *__pyx_n_s_VariantHeaderContigs_add;
  PyObject *__pyx_n_s_VariantHeaderContigs_clear_heade;
  PyObject *__pyx_n_s_VariantHeaderContigs_get;
  PyObject *__pyx_n_s_VariantHeaderContigs_items;
  PyObject *__pyx_n_s_VariantHeaderContigs_iteritems;
  PyObject *__pyx_n_s_VariantHeaderContigs_iterkeys;
  PyObject *__pyx_n_s_VariantHeaderContigs_itervalues;
  PyObject *__pyx_n_s_VariantHeaderContigs_keys;
  PyObject *__pyx_n_s_VariantHeaderContigs_remove_head;
  PyObject *__pyx_n_s_VariantHeaderContigs_values;
  PyObject *__pyx_n_s_VariantHeaderMetadata;
  PyObject *__pyx_n_u_VariantHeaderMetadata;
  PyObject *__pyx_n_s_VariantHeaderMetadata___iter;
  PyObject *__pyx_n_s_VariantHeaderMetadata___reduce_c;
  PyObject *__pyx_n_s_VariantHeaderMetadata___setstate;
  PyObject *__pyx_n_s_VariantHeaderMetadata_add;
  PyObject *__pyx_n_s_VariantHeaderMetadata_clear_head;
  PyObject *__pyx_n_s_VariantHeaderMetadata_get;
  PyObject *__pyx_n_s_VariantHeaderMetadata_items;
  PyObject *__pyx_n_s_VariantHeaderMetadata_iteritems;
  PyObject *__pyx_n_s_VariantHeaderMetadata_iterkeys;
  PyObject *__pyx_n_s_VariantHeaderMetadata_itervalues;
  PyObject *__pyx_n_s_VariantHeaderMetadata_keys;
  PyObject *__pyx_n_s_VariantHeaderMetadata_remove_hea;
  PyObject *__pyx_n_s_VariantHeaderMetadata_values;
  PyObject *__pyx_n_s_VariantHeaderRecord;
  PyObject *__pyx_n_u_VariantHeaderRecord;
  PyObject *__pyx_n_s_VariantHeaderRecord___get___loca;
  PyObject *__pyx_n_s_VariantHeaderRecord___iter;
  PyObject *__pyx_n_s_VariantHeaderRecord___reduce_cyt;
  PyObject *__pyx_n_s_VariantHeaderRecord___setstate_c;
  PyObject *__pyx_n_s_VariantHeaderRecord_get;
  PyObject *__pyx_n_s_VariantHeaderRecord_items;
  PyObject *__pyx_n_s_VariantHeaderRecord_iteritems;
  PyObject *__pyx_n_s_VariantHeaderRecord_iterkeys;
  PyObject *__pyx_n_s_VariantHeaderRecord_itervalues;
  PyObject *__pyx_n_s_VariantHeaderRecord_keys;
  PyObject *__pyx_n_s_VariantHeaderRecord_pop;
  PyObject *__pyx_n_s_VariantHeaderRecord_remove;
  PyObject *__pyx_n_s_VariantHeaderRecord_update;
  PyObject *__pyx_n_s_VariantHeaderRecord_values;
  PyObject *__pyx_n_s_VariantHeaderRecords;
  PyObject *__pyx_n_u_VariantHeaderRecords;
  PyObject *__pyx_n_s_VariantHeaderRecords___iter;
  PyObject *__pyx_n_s_VariantHeaderRecords___reduce_cy;
  PyObject *__pyx_n_s_VariantHeaderRecords___setstate;
  PyObject *__pyx_n_s_VariantHeaderSamples;
  PyObject *__pyx_n_u_VariantHeaderSamples;
  PyObject *__pyx_n_s_VariantHeaderSamples___iter;
  PyObject *__pyx_n_s_VariantHeaderSamples___reduce_cy;
  PyObject *__pyx_n_s_VariantHeaderSamples___setstate;
  PyObject *__pyx_n_s_VariantHeaderSamples_add;
  PyObject *__pyx_n_s_VariantHeader___reduce_cython;
  PyObject *__pyx_n_s_VariantHeader___setstate_cython;
  PyObject *__pyx_n_s_VariantHeader_add_line;
  PyObject *__pyx_n_s_VariantHeader_add_meta;
  PyObject *__pyx_n_s_VariantHeader_add_record;
  PyObject *__pyx_n_s_VariantHeader_add_sample;
  PyObject *__pyx_n_s_VariantHeader_add_samples;
  PyObject *__pyx_n_s_VariantHeader_copy;
  PyObject *__pyx_n_s_VariantHeader_merge;
  PyObject *__pyx_n_s_VariantHeader_new_record;
  PyObject *__pyx_n_s_VariantMetadata;
  PyObject *__pyx_n_u_VariantMetadata;
  PyObject *__pyx_n_s_VariantMetadata___reduce_cython;
  PyObject *__pyx_n_s_VariantMetadata___setstate_cytho;
  PyObject *__pyx_n_s_VariantMetadata_remove_header;
  PyObject *__pyx_n_s_VariantRecord;
  PyObject *__pyx_n_u_VariantRecord;
  PyObject *__pyx_n_s_VariantRecordFilter;
  PyObject *__pyx_n_u_VariantRecordFilter;
  PyObject *__pyx_n_s_VariantRecordFilter___iter;
  PyObject *__pyx_n_s_VariantRecordFilter___reduce_cyt;
  PyObject *__pyx_n_s_VariantRecordFilter___setstate_c;
  PyObject *__pyx_n_s_VariantRecordFilter_add;
  PyObject *__pyx_n_s_VariantRecordFilter_clear;
  PyObject *__pyx_n_s_VariantRecordFilter_get;
  PyObject *__pyx_n_s_VariantRecordFilter_items;
  PyObject *__pyx_n_s_VariantRecordFilter_iteritems;
  PyObject *__pyx_n_s_VariantRecordFilter_iterkeys;
  PyObject *__pyx_n_s_VariantRecordFilter_itervalues;
  PyObject *__pyx_n_s_VariantRecordFilter_keys;
  PyObject *__pyx_n_s_VariantRecordFilter_values;
  PyObject *__pyx_n_s_VariantRecordFormat;
  PyObject *__pyx_n_u_VariantRecordFormat;
  PyObject *__pyx_n_s_VariantRecordFormat___iter;
  PyObject *__pyx_n_s_VariantRecordFormat___reduce_cyt;
  PyObject *__pyx_n_s_VariantRecordFormat___setstate_c;
  PyObject *__pyx_n_s_VariantRecordFormat_clear;
  PyObject *__pyx_n_s_VariantRecordFormat_get;
  PyObject *__pyx_n_s_VariantRecordFormat_items;
  PyObject *__pyx_n_s_VariantRecordFormat_iteritems;
  PyObject *__pyx_n_s_VariantRecordFormat_iterkeys;
  PyObject *__pyx_n_s_VariantRecordFormat_itervalues;
  PyObject *__pyx_n_s_VariantRecordFormat_keys;
  PyObject *__pyx_n_s_VariantRecordFormat_values;
  PyObject *__pyx_n_s_VariantRecordInfo;
  PyObject *__pyx_n_u_VariantRecordInfo;
  PyObject *__pyx_n_s_VariantRecordInfo___iter;
  PyObject *__pyx_n_s_VariantRecordInfo___reduce_cytho;
  PyObject *__pyx_n_s_VariantRecordInfo___setstate_cyt;
  PyObject *__pyx_n_s_VariantRecordInfo_clear;
  PyObject *__pyx_n_s_VariantRecordInfo_get;
  PyObject *__pyx_n_s_VariantRecordInfo_items;
  PyObject *__pyx_n_s_VariantRecordInfo_iteritems;
  PyObject *__pyx_n_s_VariantRecordInfo_iterkeys;
  PyObject *__pyx_n_s_VariantRecordInfo_itervalues;
  PyObject *__pyx_n_s_VariantRecordInfo_keys;
  PyObject *__pyx_n_s_VariantRecordInfo_pop;
  PyObject *__pyx_n_s_VariantRecordInfo_update;
  PyObject *__pyx_n_s_VariantRecordInfo_values;
  PyObject *__pyx_n_s_VariantRecordSample;
  PyObject *__pyx_n_u_VariantRecordSample;
  PyObject *__pyx_n_s_VariantRecordSample___iter;
  PyObject *__pyx_n_s_VariantRecordSample___reduce_cyt;
  PyObject *__pyx_n_s_VariantRecordSample___set___loca;
  PyObject *__pyx_n_s_VariantRecordSample___setstate_c;
  PyObject *__pyx_n_s_VariantRecordSample_clear;
  PyObject *__pyx_n_s_VariantRecordSample_get;
  PyObject *__pyx_n_s_VariantRecordSample_items;
  PyObject *__pyx_n_s_VariantRecordSample_iteritems;
  PyObject *__pyx_n_s_VariantRecordSample_iterkeys;
  PyObject *__pyx_n_s_VariantRecordSample_itervalues;
  PyObject *__pyx_n_s_VariantRecordSample_keys;
  PyObject *__pyx_n_s_VariantRecordSample_pop;
  PyObject *__pyx_n_s_VariantRecordSample_update;
  PyObject *__pyx_n_s_VariantRecordSample_values;
  PyObject *__pyx_n_s_VariantRecordSamples;
  PyObject *__pyx_n_u_VariantRecordSamples;
  PyObject *__pyx_n_s_VariantRecordSamples___iter;
  PyObject *__pyx_n_s_VariantRecordSamples___reduce_cy;
  PyObject *__pyx_n_s_VariantRecordSamples___setstate;
  PyObject *__pyx_n_s_VariantRecordSamples_get;
  PyObject *__pyx_n_s_VariantRecordSamples_items;
  PyObject *__pyx_n_s_VariantRecordSamples_iteritems;
  PyObject *__pyx_n_s_VariantRecordSamples_iterkeys;
  PyObject *__pyx_n_s_VariantRecordSamples_itervalues;
  PyObject *__pyx_n_s_VariantRecordSamples_keys;
  PyObject *__pyx_n_s_VariantRecordSamples_pop;
  PyObject *__pyx_n_s_VariantRecordSamples_update;
  PyObject *__pyx_n_s_VariantRecordSamples_values;
  PyObject *__pyx_n_s_VariantRecord___reduce_cython;
  PyObject *__pyx_n_s_VariantRecord___setstate_cython;
  PyObject *__pyx_n_s_VariantRecord_copy;
  PyObject *__pyx_n_s_VariantRecord_translate;
  PyObject *__pyx_kp_b__12;
  PyObject *__pyx_kp_u__12;
  PyObject *__pyx_kp_u__181;
  PyObject *__pyx_kp_b__2;
  PyObject *__pyx_kp_u__2;
  PyObject *__pyx_kp_b__241;
  PyObject *__pyx_n_s__278;
  PyObject *__pyx_n_s__323;
  PyObject *__pyx_n_s__330;
  PyObject *__pyx_kp_b__52;
  PyObject *__pyx_kp_u__52;
  PyObject *__pyx_kp_u__53;
  PyObject *__pyx_n_s_add;
  PyObject *__pyx_n_s_add_line;
  PyObject *__pyx_n_s_add_meta;
  PyObject *__pyx_n_s_add_record;
  PyObject *__pyx_n_s_add_sample;
  PyObject *__pyx_n_s_add_samples;
  PyObject *__pyx_n_s_all;
  PyObject *__pyx_n_s_alleles;
  PyObject *__pyx_n_s_append;
  PyObject *__pyx_n_s_arg;
  PyObject *__pyx_n_s_args;
  PyObject *__pyx_n_s_asyncio_coroutines;
  PyObject *__pyx_n_s_bcf;
  PyObject *__pyx_kp_u_bcf_2;
  PyObject *__pyx_n_s_bcf_array_to_object_locals_genex;
  PyObject *__pyx_n_s_bcf_check_values_locals_genexpr;
  PyObject *__pyx_kp_u_bcf_hdr_format_failed;
  PyObject *__pyx_kp_u_bcf_hdr_set_samples_failed_ret;
  PyObject *__pyx_kp_u_bcf_index_required;
  PyObject *__pyx_kp_u_bcf_must_not_be_None;
  PyObject *__pyx_n_s_bcf_object_to_array_locals_genex;
  PyObject *__pyx_n_u_bcguz;
  PyObject *__pyx_n_u_bcguz0123456789ex;
  PyObject *__pyx_n_s_bgzfp;
  PyObject *__pyx_n_s_bkey;
  PyObject *__pyx_n_s_bline;
  PyObject *__pyx_kp_u_cannot_convert_deleted_record_to;
  PyObject *__pyx_kp_u_cannot_create_VariantHeader;
  PyObject *__pyx_kp_u_cannot_create_VariantRecord;
  PyObject *__pyx_kp_u_cannot_create_VariantRecordSampl;
  PyObject *__pyx_kp_u_cannot_fetch_from_Variantfile_op;
  PyObject *__pyx_kp_u_cannot_find_metadata_key;
  PyObject *__pyx_kp_u_cannot_iterate_over_Variantfile;
  PyObject *__pyx_kp_u_cannot_set_null_allele;
  PyObject *__pyx_kp_u_cannot_set_null_alt_allele;
  PyObject *__pyx_kp_u_cannot_subset_samples_after_fetc;
  PyObject *__pyx_kp_u_cannot_subset_samples_from_Varia;
  PyObject *__pyx_kp_u_cannot_write_to_a_Variantfile_op;
  PyObject *__pyx_n_s_cfilename;
  PyObject *__pyx_n_s_char_array_to_tuple_locals_genex;
  PyObject *__pyx_n_s_check_truncation;
  PyObject *__pyx_n_s_chr;
  PyObject *__pyx_n_s_cindex_filename;
  PyObject *__pyx_n_s_ckey;
  PyObject *__pyx_n_s_class_getitem;
  PyObject *__pyx_n_s_clear;
  PyObject *__pyx_n_s_clear_header;
  PyObject *__pyx_n_s_cline_in_traceback;
  PyObject *__pyx_n_s_close;
  PyObject *__pyx_n_s_cmode;
  PyObject *__pyx_n_s_contig;
  PyObject *__pyx_n_u_contig;
  PyObject *__pyx_kp_u_contig_must_be_specified;
  PyObject *__pyx_n_s_copy;
  PyObject *__pyx_kp_u_could_not_open_file_mode;
  PyObject *__pyx_kp_u_could_not_open_variant_file;
  PyObject *__pyx_kp_u_could_not_open_variant_file_2;
  PyObject *__pyx_n_s_d;
  PyObject *__pyx_n_s_default;
  PyObject *__pyx_n_s_description;
  PyObject *__pyx_n_s_dict;
  PyObject *__pyx_n_s_dict_2;
  PyObject *__pyx_kp_u_disable;
  PyObject *__pyx_n_s_drop_samples;
  PyObject *__pyx_n_s_dst_hdr;
  PyObject *__pyx_n_s_dst_header;
  PyObject *__pyx_kp_u_dst_header_must_not_be_None;
  PyObject *__pyx_n_s_duplicate_filehandle;
  PyObject *__pyx_kp_u_either_value_or_items_must_be_sp;
  PyObject *__pyx_kp_u_enable;
  PyObject *__pyx_n_s_end;
  PyObject *__pyx_n_s_endswith;
  PyObject *__pyx_n_s_enumerate;
  PyObject *__pyx_kp_u_error_in_bcf_subset_format;
  PyObject *__pyx_kp_u_error_in_vcf_parse;
  PyObject *__pyx_n_s_f;
  PyObject *__pyx_n_s_fetch;
  PyObject *__pyx_kp_u_fetch_requires_an_index;
  PyObject *__pyx_kp_u_file_does_not_have_valid_header;
  PyObject *__pyx_n_s_filename;
  PyObject *__pyx_n_s_filter;
  PyObject *__pyx_n_s_fmt;
  PyObject *__pyx_n_s_format;
  PyObject *__pyx_n_s_format_modes;
  PyObject *__pyx_kp_u_gc;
  PyObject *__pyx_n_s_genexpr;
  PyObject *__pyx_kp_u_genotype_is_only_valid_as_a_form;
  PyObject *__pyx_n_s_get;
  PyObject *__pyx_n_s_get_reference_name;
  PyObject *__pyx_n_s_get_tid;
  PyObject *__pyx_n_s_getstate;
  PyObject *__pyx_kp_u_gz;
  PyObject *__pyx_n_s_hash;
  PyObject *__pyx_n_s_hdr;
  PyObject *__pyx_n_s_header;
  PyObject *__pyx_kp_u_header_must_not_be_None;
  PyObject *__pyx_n_s_hrec;
  PyObject *__pyx_n_s_i;
  PyObject *__pyx_n_s_id;
  PyObject *__pyx_n_s_idx;
  PyObject *__pyx_n_s_ignore_truncation;
  PyObject *__pyx_n_s_import;
  PyObject *__pyx_n_s_include_samples;
  PyObject *__pyx_n_s_index;
  PyObject *__pyx_n_s_index_filename;
  PyObject *__pyx_n_s_info;
  PyObject *__pyx_n_s_info_id;
  PyObject *__pyx_n_s_init;
  PyObject *__pyx_n_s_initializing;
  PyObject *__pyx_kp_u_invalid_FORMAT;
  PyObject *__pyx_kp_u_invalid_VariantHeader;
  PyObject *__pyx_kp_u_invalid_VariantRecord;
  PyObject *__pyx_kp_u_invalid_character_found;
  PyObject *__pyx_kp_u_invalid_contig;
  PyObject *__pyx_kp_u_invalid_contig_2;
  PyObject *__pyx_kp_u_invalid_contig_id;
  PyObject *__pyx_kp_u_invalid_contig_index;
  PyObject *__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF;
  PyObject *__pyx_kp_u_invalid_filter_index;
  PyObject *__pyx_kp_u_invalid_header_line;
  PyObject *__pyx_kp_u_invalid_header_record_index;
  PyObject *__pyx_kp_u_invalid_key;
  PyObject *__pyx_kp_u_invalid_metadata_id;
  PyObject *__pyx_kp_u_invalid_metadata_type;
  PyObject *__pyx_kp_u_invalid_mode_options;
  PyObject *__pyx_n_s_invalid_modes;
  PyObject *__pyx_kp_u_invalid_number_of_columns;
  PyObject *__pyx_kp_u_invalid_reference_id;
  PyObject *__pyx_kp_u_invalid_sample_index;
  PyObject *__pyx_kp_u_invalid_sample_name;
  PyObject *__pyx_kp_u_invalid_tag;
  PyObject *__pyx_kp_u_invalid_value_for_Float_format;
  PyObject *__pyx_kp_u_invalid_value_for_Integer_format;
  PyObject *__pyx_n_s_is_coroutine;
  PyObject *__pyx_n_s_is_open;
  PyObject *__pyx_n_s_is_valid_tid;
  PyObject *__pyx_kp_u_isenabled;
  PyObject *__pyx_n_s_items;
  PyObject *__pyx_n_s_iter;
  PyObject *__pyx_n_s_iteritems;
  PyObject *__pyx_n_s_iterkeys;
  PyObject *__pyx_n_s_itervalues;
  PyObject *__pyx_n_s_join;
  PyObject *__pyx_n_s_k;
  PyObject *__pyx_n_s_key;
  PyObject *__pyx_n_s_keys;
  PyObject *__pyx_n_s_kwargs;
  PyObject *__pyx_n_s_length;
  PyObject *__pyx_n_u_length;
  PyObject *__pyx_kp_u_limits_violated;
  PyObject *__pyx_n_s_line;
  PyObject *__pyx_n_s_m;
  PyObject *__pyx_n_s_main;
  PyObject *__pyx_n_s_merge;
  PyObject *__pyx_kp_u_missing_d_requested_samples;
  PyObject *__pyx_n_s_mode;
  PyObject *__pyx_kp_u_mode_contains_conflicting_format;
  PyObject *__pyx_kp_u_mode_must_begin_with_r_w_or_a;
  PyObject *__pyx_n_s_msg;
  PyObject *__pyx_kp_u_must_set_at_least_2_alleles;
  PyObject *__pyx_n_s_n;
  PyObject *__pyx_n_s_name;
  PyObject *__pyx_n_s_name_2;
  PyObject *__pyx_n_s_new;
  PyObject *__pyx_n_s_new_record;
  PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
  PyObject *__pyx_n_s_number;
  PyObject *__pyx_n_s_object;
  PyObject *__pyx_n_s_open;
  PyObject *__pyx_n_s_os;
  PyObject *__pyx_n_s_parse_region;
  PyObject *__pyx_n_s_phased;
  PyObject *__pyx_n_u_phased;
  PyObject *__pyx_n_s_pickle;
  PyObject *__pyx_n_s_pop;
  PyObject *__pyx_n_s_pysam_libcbcf;
  PyObject *__pyx_kp_s_pysam_libcbcf_pyx;
  PyObject *__pyx_n_s_pysam_utils;
  PyObject *__pyx_n_s_pyx_PickleError;
  PyObject *__pyx_n_s_pyx_checksum;
  PyObject *__pyx_n_s_pyx_result;
  PyObject *__pyx_n_s_pyx_state;
  PyObject *__pyx_n_s_pyx_type;
  PyObject *__pyx_n_s_pyx_unpickle_BaseIndex;
  PyObject *__pyx_n_s_pyx_unpickle_VariantContig;
  PyObject *__pyx_n_s_pyx_unpickle_VariantHeaderCont;
  PyObject *__pyx_n_s_pyx_unpickle_VariantHeaderMeta;
  PyObject *__pyx_n_s_pyx_unpickle_VariantHeaderReco;
  PyObject *__pyx_n_s_pyx_unpickle_VariantHeaderSamp;
  PyObject *__pyx_n_s_pyx_unpickle_VariantMetadata;
  PyObject *__pyx_n_s_pyx_unpickle_VariantRecordFilt;
  PyObject *__pyx_n_s_pyx_unpickle_VariantRecordForm;
  PyObject *__pyx_n_s_pyx_unpickle_VariantRecordInfo;
  PyObject *__pyx_n_s_pyx_unpickle_VariantRecordSamp;
  PyObject *__pyx_n_s_pyx_unpickle_VariantRecordSamp_2;
  PyObject *__pyx_n_s_pyx_vtable;
  PyObject *__pyx_n_s_qual;
  PyObject *__pyx_n_s_quoted;
  PyObject *__pyx_n_b_r;
  PyObject *__pyx_n_s_r;
  PyObject *__pyx_n_u_r;
  PyObject *__pyx_n_s_range;
  PyObject *__pyx_n_s_rec;
  PyObject *__pyx_n_s_record;
  PyObject *__pyx_kp_u_record_must_not_be_None;
  PyObject *__pyx_n_s_records;
  PyObject *__pyx_n_s_reduce;
  PyObject *__pyx_n_s_reduce_cython;
  PyObject *__pyx_n_s_reduce_ex;
  PyObject *__pyx_n_s_ref;
  PyObject *__pyx_kp_u_ref_allele_must_not_be_null;
  PyObject *__pyx_n_s_reference;
  PyObject *__pyx_n_s_region;
  PyObject *__pyx_n_s_remap;
  PyObject *__pyx_n_s_remove;
  PyObject *__pyx_n_s_remove_header;
  PyObject *__pyx_n_s_reopen;
  PyObject *__pyx_n_s_reset;
  PyObject *__pyx_n_s_ret;
  PyObject *__pyx_n_s_reversed;
  PyObject *__pyx_n_s_rid;
  PyObject *__pyx_n_u_rwa;
  PyObject *__pyx_n_s_sample;
  PyObject *__pyx_kp_u_sample_must_not_be_None;
  PyObject *__pyx_n_s_samples;
  PyObject *__pyx_n_s_seek;
  PyObject *__pyx_n_s_self;
  PyObject *__pyx_kp_s_self_iter_cannot_be_converted_to;
  PyObject *__pyx_kp_s_self_ptr_cannot_be_converted_to;
  PyObject *__pyx_n_s_send;
  PyObject *__pyx_n_s_setstate;
  PyObject *__pyx_n_s_setstate_cython;
  PyObject *__pyx_n_s_spec;
  PyObject *__pyx_n_s_split;
  PyObject *__pyx_n_s_src_hdr;
  PyObject *__pyx_n_s_start;
  PyObject *__pyx_n_s_startswith;
  PyObject *__pyx_n_s_state;
  PyObject *__pyx_n_s_stop;
  PyObject *__pyx_kp_s_stringsource;
  PyObject *__pyx_n_s_strip;
  PyObject *__pyx_n_s_subset_samples;
  PyObject *__pyx_n_s_sys;
  PyObject *__pyx_kp_u_tabix_index_required;
  PyObject *__pyx_n_s_tell;
  PyObject *__pyx_n_s_test;
  PyObject *__pyx_kp_u_this_class_cannot_be_instantiate;
  PyObject *__pyx_n_s_threads;
  PyObject *__pyx_n_s_throw;
  PyObject *__pyx_n_s_tid;
  PyObject *__pyx_n_s_tidx;
  PyObject *__pyx_n_s_translate;
  PyObject *__pyx_kp_u_truncated_file;
  PyObject *__pyx_n_s_type;
  PyObject *__pyx_kp_u_unable_to_allocate_BCF_record;
  PyObject *__pyx_kp_u_unable_to_fetch;
  PyObject *__pyx_kp_u_unable_to_fetch_next_record;
  PyObject *__pyx_kp_u_unable_to_parse_next_record;
  PyObject *__pyx_kp_u_unable_to_reallocate_VariantHead;
  PyObject *__pyx_kp_u_unknown_INFO;
  PyObject *__pyx_kp_u_unknown_format;
  PyObject *__pyx_kp_u_unknown_mode;
  PyObject *__pyx_kp_u_unknown_type_specified;
  PyObject *__pyx_n_s_unquoted_str;
  PyObject *__pyx_kp_u_unsupported_header_type_code;
  PyObject *__pyx_kp_u_unsupported_info_type_code;
  PyObject *__pyx_kp_u_unsupported_type;
  PyObject *__pyx_kp_u_unsupported_types;
  PyObject *__pyx_n_s_update;
  PyObject *__pyx_n_s_upper;
  PyObject *__pyx_n_s_use_setstate;
  PyObject *__pyx_kp_u_utf_8;
  PyObject *__pyx_n_s_v;
  PyObject *__pyx_n_s_value;
  PyObject *__pyx_kp_u_value_expected_to_be_scalar_give;
  PyObject *__pyx_n_s_values;
  PyObject *__pyx_kp_u_values_expected_to_be_tuple_give;
  PyObject *__pyx_n_s_vars;
  PyObject *__pyx_kp_u_vcf_format_failed;
  PyObject *__pyx_n_b_w;
  PyObject *__pyx_n_u_w;
  PyObject *__pyx_n_u_wb;
  PyObject *__pyx_n_u_wb0;
  PyObject *__pyx_n_u_wbu;
  PyObject *__pyx_n_s_write;
  PyObject *__pyx_n_u_wz;
  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;
  PyObject *__pyx_k__41;
  PyObject *__pyx_k__146;
  PyObject *__pyx_k__158;
  PyObject *__pyx_k__193;
  PyObject *__pyx_k__206;
  PyObject *__pyx_tuple_;
  PyObject *__pyx_tuple__3;
  PyObject *__pyx_tuple__4;
  PyObject *__pyx_tuple__5;
  PyObject *__pyx_tuple__6;
  PyObject *__pyx_tuple__7;
  PyObject *__pyx_tuple__8;
  PyObject *__pyx_tuple__9;
  PyObject *__pyx_tuple__10;
  PyObject *__pyx_tuple__11;
  PyObject *__pyx_tuple__13;
  PyObject *__pyx_tuple__14;
  PyObject *__pyx_tuple__15;
  PyObject *__pyx_tuple__16;
  PyObject *__pyx_tuple__17;
  PyObject *__pyx_tuple__18;
  PyObject *__pyx_tuple__19;
  PyObject *__pyx_tuple__20;
  PyObject *__pyx_tuple__21;
  PyObject *__pyx_tuple__22;
  PyObject *__pyx_tuple__23;
  PyObject *__pyx_tuple__24;
  PyObject *__pyx_tuple__25;
  PyObject *__pyx_tuple__26;
  PyObject *__pyx_tuple__27;
  PyObject *__pyx_tuple__28;
  PyObject *__pyx_tuple__29;
  PyObject *__pyx_tuple__30;
  PyObject *__pyx_tuple__31;
  PyObject *__pyx_tuple__32;
  PyObject *__pyx_tuple__43;
  PyObject *__pyx_tuple__47;
  PyObject *__pyx_tuple__48;
  PyObject *__pyx_tuple__51;
  PyObject *__pyx_tuple__57;
  PyObject *__pyx_tuple__58;
  PyObject *__pyx_tuple__60;
  PyObject *__pyx_tuple__61;
  PyObject *__pyx_tuple__76;
  PyObject *__pyx_tuple__77;
  PyObject *__pyx_tuple__88;
  PyObject *__pyx_tuple__91;
  PyObject *__pyx_tuple__95;
  PyObject *__pyx_tuple__98;
  PyObject *__pyx_slice__240;
  PyObject *__pyx_tuple__100;
  PyObject *__pyx_tuple__103;
  PyObject *__pyx_tuple__105;
  PyObject *__pyx_tuple__106;
  PyObject *__pyx_tuple__111;
  PyObject *__pyx_tuple__123;
  PyObject *__pyx_tuple__124;
  PyObject *__pyx_tuple__135;
  PyObject *__pyx_tuple__136;
  PyObject *__pyx_tuple__164;
  PyObject *__pyx_tuple__165;
  PyObject *__pyx_tuple__166;
  PyObject *__pyx_tuple__167;
  PyObject *__pyx_tuple__168;
  PyObject *__pyx_tuple__169;
  PyObject *__pyx_tuple__170;
  PyObject *__pyx_tuple__171;
  PyObject *__pyx_tuple__172;
  PyObject *__pyx_tuple__173;
  PyObject *__pyx_tuple__174;
  PyObject *__pyx_tuple__175;
  PyObject *__pyx_tuple__176;
  PyObject *__pyx_tuple__177;
  PyObject *__pyx_tuple__180;
  PyObject *__pyx_tuple__182;
  PyObject *__pyx_tuple__183;
  PyObject *__pyx_tuple__197;
  PyObject *__pyx_tuple__210;
  PyObject *__pyx_tuple__219;
  PyObject *__pyx_tuple__220;
  PyObject *__pyx_tuple__221;
  PyObject *__pyx_tuple__222;
  PyObject *__pyx_tuple__223;
  PyObject *__pyx_tuple__224;
  PyObject *__pyx_tuple__227;
  PyObject *__pyx_tuple__228;
  PyObject *__pyx_tuple__232;
  PyObject *__pyx_tuple__233;
  PyObject *__pyx_tuple__234;
  PyObject *__pyx_tuple__236;
  PyObject *__pyx_tuple__238;
  PyObject *__pyx_tuple__239;
  PyObject *__pyx_tuple__242;
  PyObject *__pyx_tuple__247;
  PyObject *__pyx_tuple__249;
  PyObject *__pyx_tuple__250;
  PyObject *__pyx_tuple__253;
  PyObject *__pyx_tuple__255;
  PyObject *__pyx_tuple__256;
  PyObject *__pyx_tuple__260;
  PyObject *__pyx_tuple__262;
  PyObject *__pyx_tuple__264;
  PyObject *__pyx_tuple__266;
  PyObject *__pyx_tuple__270;
  PyObject *__pyx_tuple__275;
  PyObject *__pyx_tuple__277;
  PyObject *__pyx_tuple__279;
  PyObject *__pyx_tuple__280;
  PyObject *__pyx_tuple__281;
  PyObject *__pyx_tuple__282;
  PyObject *__pyx_tuple__283;
  PyObject *__pyx_tuple__284;
  PyObject *__pyx_tuple__285;
  PyObject *__pyx_tuple__286;
  PyObject *__pyx_tuple__287;
  PyObject *__pyx_tuple__288;
  PyObject *__pyx_tuple__289;
  PyObject *__pyx_tuple__290;
  PyObject *__pyx_tuple__291;
  PyObject *__pyx_tuple__292;
  PyObject *__pyx_tuple__293;
  PyObject *__pyx_tuple__294;
  PyObject *__pyx_tuple__295;
  PyObject *__pyx_tuple__296;
  PyObject *__pyx_tuple__297;
  PyObject *__pyx_tuple__298;
  PyObject *__pyx_tuple__299;
  PyObject *__pyx_tuple__300;
  PyObject *__pyx_tuple__301;
  PyObject *__pyx_tuple__302;
  PyObject *__pyx_tuple__303;
  PyObject *__pyx_tuple__304;
  PyObject *__pyx_tuple__305;
  PyObject *__pyx_tuple__306;
  PyObject *__pyx_tuple__307;
  PyObject *__pyx_tuple__308;
  PyObject *__pyx_tuple__309;
  PyObject *__pyx_tuple__310;
  PyObject *__pyx_tuple__311;
  PyObject *__pyx_tuple__312;
  PyObject *__pyx_tuple__313;
  PyObject *__pyx_tuple__314;
  PyObject *__pyx_tuple__315;
  PyObject *__pyx_tuple__316;
  PyObject *__pyx_tuple__317;
  PyObject *__pyx_tuple__318;
  PyObject *__pyx_tuple__319;
  PyObject *__pyx_tuple__320;
  PyObject *__pyx_tuple__321;
  PyObject *__pyx_tuple__322;
  PyObject *__pyx_tuple__324;
  PyObject *__pyx_tuple__325;
  PyObject *__pyx_tuple__326;
  PyObject *__pyx_tuple__327;
  PyObject *__pyx_tuple__328;
  PyObject *__pyx_tuple__329;
  PyObject *__pyx_codeobj__33;
  PyObject *__pyx_codeobj__34;
  PyObject *__pyx_codeobj__35;
  PyObject *__pyx_codeobj__36;
  PyObject *__pyx_codeobj__37;
  PyObject *__pyx_codeobj__38;
  PyObject *__pyx_codeobj__39;
  PyObject *__pyx_codeobj__40;
  PyObject *__pyx_codeobj__42;
  PyObject *__pyx_codeobj__44;
  PyObject *__pyx_codeobj__45;
  PyObject *__pyx_codeobj__46;
  PyObject *__pyx_codeobj__49;
  PyObject *__pyx_codeobj__50;
  PyObject *__pyx_codeobj__54;
  PyObject *__pyx_codeobj__55;
  PyObject *__pyx_codeobj__56;
  PyObject *__pyx_codeobj__59;
  PyObject *__pyx_codeobj__62;
  PyObject *__pyx_codeobj__63;
  PyObject *__pyx_codeobj__64;
  PyObject *__pyx_codeobj__65;
  PyObject *__pyx_codeobj__66;
  PyObject *__pyx_codeobj__67;
  PyObject *__pyx_codeobj__68;
  PyObject *__pyx_codeobj__69;
  PyObject *__pyx_codeobj__70;
  PyObject *__pyx_codeobj__71;
  PyObject *__pyx_codeobj__72;
  PyObject *__pyx_codeobj__73;
  PyObject *__pyx_codeobj__74;
  PyObject *__pyx_codeobj__75;
  PyObject *__pyx_codeobj__78;
  PyObject *__pyx_codeobj__79;
  PyObject *__pyx_codeobj__80;
  PyObject *__pyx_codeobj__81;
  PyObject *__pyx_codeobj__82;
  PyObject *__pyx_codeobj__83;
  PyObject *__pyx_codeobj__84;
  PyObject *__pyx_codeobj__85;
  PyObject *__pyx_codeobj__86;
  PyObject *__pyx_codeobj__87;
  PyObject *__pyx_codeobj__89;
  PyObject *__pyx_codeobj__90;
  PyObject *__pyx_codeobj__92;
  PyObject *__pyx_codeobj__93;
  PyObject *__pyx_codeobj__94;
  PyObject *__pyx_codeobj__96;
  PyObject *__pyx_codeobj__97;
  PyObject *__pyx_codeobj__99;
  PyObject *__pyx_codeobj__101;
  PyObject *__pyx_codeobj__102;
  PyObject *__pyx_codeobj__104;
  PyObject *__pyx_codeobj__107;
  PyObject *__pyx_codeobj__108;
  PyObject *__pyx_codeobj__109;
  PyObject *__pyx_codeobj__110;
  PyObject *__pyx_codeobj__112;
  PyObject *__pyx_codeobj__113;
  PyObject *__pyx_codeobj__114;
  PyObject *__pyx_codeobj__115;
  PyObject *__pyx_codeobj__116;
  PyObject *__pyx_codeobj__117;
  PyObject *__pyx_codeobj__118;
  PyObject *__pyx_codeobj__119;
  PyObject *__pyx_codeobj__120;
  PyObject *__pyx_codeobj__121;
  PyObject *__pyx_codeobj__122;
  PyObject *__pyx_codeobj__125;
  PyObject *__pyx_codeobj__126;
  PyObject *__pyx_codeobj__127;
  PyObject *__pyx_codeobj__128;
  PyObject *__pyx_codeobj__129;
  PyObject *__pyx_codeobj__130;
  PyObject *__pyx_codeobj__131;
  PyObject *__pyx_codeobj__132;
  PyObject *__pyx_codeobj__133;
  PyObject *__pyx_codeobj__134;
  PyObject *__pyx_codeobj__137;
  PyObject *__pyx_codeobj__138;
  PyObject *__pyx_codeobj__139;
  PyObject *__pyx_codeobj__140;
  PyObject *__pyx_codeobj__141;
  PyObject *__pyx_codeobj__142;
  PyObject *__pyx_codeobj__143;
  PyObject *__pyx_codeobj__144;
  PyObject *__pyx_codeobj__145;
  PyObject *__pyx_codeobj__147;
  PyObject *__pyx_codeobj__148;
  PyObject *__pyx_codeobj__149;
  PyObject *__pyx_codeobj__150;
  PyObject *__pyx_codeobj__151;
  PyObject *__pyx_codeobj__152;
  PyObject *__pyx_codeobj__153;
  PyObject *__pyx_codeobj__154;
  PyObject *__pyx_codeobj__155;
  PyObject *__pyx_codeobj__156;
  PyObject *__pyx_codeobj__157;
  PyObject *__pyx_codeobj__159;
  PyObject *__pyx_codeobj__160;
  PyObject *__pyx_codeobj__161;
  PyObject *__pyx_codeobj__162;
  PyObject *__pyx_codeobj__163;
  PyObject *__pyx_codeobj__178;
  PyObject *__pyx_codeobj__179;
  PyObject *__pyx_codeobj__184;
  PyObject *__pyx_codeobj__185;
  PyObject *__pyx_codeobj__186;
  PyObject *__pyx_codeobj__187;
  PyObject *__pyx_codeobj__188;
  PyObject *__pyx_codeobj__189;
  PyObject *__pyx_codeobj__190;
  PyObject *__pyx_codeobj__191;
  PyObject *__pyx_codeobj__192;
  PyObject *__pyx_codeobj__194;
  PyObject *__pyx_codeobj__195;
  PyObject *__pyx_codeobj__196;
  PyObject *__pyx_codeobj__198;
  PyObject *__pyx_codeobj__199;
  PyObject *__pyx_codeobj__200;
  PyObject *__pyx_codeobj__201;
  PyObject *__pyx_codeobj__202;
  PyObject *__pyx_codeobj__203;
  PyObject *__pyx_codeobj__204;
  PyObject *__pyx_codeobj__205;
  PyObject *__pyx_codeobj__207;
  PyObject *__pyx_codeobj__208;
  PyObject *__pyx_codeobj__209;
  PyObject *__pyx_codeobj__211;
  PyObject *__pyx_codeobj__212;
  PyObject *__pyx_codeobj__213;
  PyObject *__pyx_codeobj__214;
  PyObject *__pyx_codeobj__215;
  PyObject *__pyx_codeobj__216;
  PyObject *__pyx_codeobj__217;
  PyObject *__pyx_codeobj__218;
  PyObject *__pyx_codeobj__225;
  PyObject *__pyx_codeobj__226;
  PyObject *__pyx_codeobj__229;
  PyObject *__pyx_codeobj__230;
  PyObject *__pyx_codeobj__231;
  PyObject *__pyx_codeobj__235;
  PyObject *__pyx_codeobj__237;
  PyObject *__pyx_codeobj__243;
  PyObject *__pyx_codeobj__244;
  PyObject *__pyx_codeobj__245;
  PyObject *__pyx_codeobj__246;
  PyObject *__pyx_codeobj__248;
  PyObject *__pyx_codeobj__251;
  PyObject *__pyx_codeobj__252;
  PyObject *__pyx_codeobj__254;
  PyObject *__pyx_codeobj__257;
  PyObject *__pyx_codeobj__258;
  PyObject *__pyx_codeobj__259;
  PyObject *__pyx_codeobj__261;
  PyObject *__pyx_codeobj__263;
  PyObject *__pyx_codeobj__265;
  PyObject *__pyx_codeobj__267;
  PyObject *__pyx_codeobj__268;
  PyObject *__pyx_codeobj__269;
  PyObject *__pyx_codeobj__271;
  PyObject *__pyx_codeobj__272;
  PyObject *__pyx_codeobj__273;
  PyObject *__pyx_codeobj__274;
  PyObject *__pyx_codeobj__276;
} __pyx_mstate;

#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(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))

#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))

#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
#else
static __pyx_mstate __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static int __pyx_m_clear(PyObject *m) {
  __pyx_mstate *clear_module_state = __pyx_mstate(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
  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_n_u_A);
  Py_CLEAR(clear_module_state->__pyx_n_u_ALT);
  Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIndex);
  Py_CLEAR(clear_module_state->__pyx_n_u_BCFIndex);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIndex___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIndex___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIndex_fetch);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIterator);
  Py_CLEAR(clear_module_state->__pyx_n_u_BCFIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIterator___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BCFIterator___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_u_BND);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex);
  Py_CLEAR(clear_module_state->__pyx_n_u_BaseIndex);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIndex_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIterator);
  Py_CLEAR(clear_module_state->__pyx_n_u_BaseIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIterator___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_BaseIterator___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_u_CONTIG);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_add_extra_threads_when_ig);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_copy_arrays_with_src_valu);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_create_empty_array);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_re_open_htsfile);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_set_phased_before_genotyp);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_specify_an_index_filename);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_translate_record_Number_o);
  Py_CLEAR(clear_module_state->__pyx_n_u_Description);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Duplicated_sample_name);
  Py_CLEAR(clear_module_state->__pyx_n_b_END);
  Py_CLEAR(clear_module_state->__pyx_n_u_END);
  Py_CLEAR(clear_module_state->__pyx_kp_u_END_is_a_reserved_attribute_acce);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_extracting_ID);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_s_reading_record);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_unpacking_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_updating_alleles);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Error_updating_id);
  Py_CLEAR(clear_module_state->__pyx_n_u_FILTER);
  Py_CLEAR(clear_module_state->__pyx_n_u_FIXED);
  Py_CLEAR(clear_module_state->__pyx_n_u_FORMAT);
  Py_CLEAR(clear_module_state->__pyx_n_u_Flag);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Flag_types_are_not_allowed_on_FO);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Flag_values_must_be_True_False_N);
  Py_CLEAR(clear_module_state->__pyx_n_u_Float);
  Py_CLEAR(clear_module_state->__pyx_n_u_G);
  Py_CLEAR(clear_module_state->__pyx_n_u_GENERIC);
  Py_CLEAR(clear_module_state->__pyx_n_u_GT);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Header_already_exists_for_contig);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Header_already_exists_for_id);
  Py_CLEAR(clear_module_state->__pyx_n_u_ID);
  Py_CLEAR(clear_module_state->__pyx_n_u_INDEL);
  Py_CLEAR(clear_module_state->__pyx_n_u_INFO);
  Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_I_O_operation_on_closed_file);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6);
  Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7);
  Py_CLEAR(clear_module_state->__pyx_n_s_IndexError);
  Py_CLEAR(clear_module_state->__pyx_n_u_Integer);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Integer_value_too_small_large_to);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_INFO_field);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_VariantRecord_Number_of);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_allele_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_chromosome_contig);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_filter);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_header);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_header_id);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_header_record_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_index_object);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_tid);
  Py_CLEAR(clear_module_state->__pyx_n_s_KeyError);
  Py_CLEAR(clear_module_state->__pyx_n_u_MNP);
  Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_NON_REF);
  Py_CLEAR(clear_module_state->__pyx_n_s_NotImplemented);
  Py_CLEAR(clear_module_state->__pyx_n_u_Number);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Number_must_be_None_when_adding);
  Py_CLEAR(clear_module_state->__pyx_n_u_OTHER);
  Py_CLEAR(clear_module_state->__pyx_n_u_OVERLAP);
  Py_CLEAR(clear_module_state->__pyx_kp_u_One_or_more_of_the_supplied_samp);
  Py_CLEAR(clear_module_state->__pyx_n_u_PASS);
  Py_CLEAR(clear_module_state->__pyx_n_s_PickleError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Position_must_be_positive);
  Py_CLEAR(clear_module_state->__pyx_n_u_R);
  Py_CLEAR(clear_module_state->__pyx_n_u_REF);
  Py_CLEAR(clear_module_state->__pyx_n_u_SNP);
  Py_CLEAR(clear_module_state->__pyx_n_u_STRUCTURED);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Start_coordinate_must_be_non_neg);
  Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Stop_coordinate_must_be_non_nega);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Stop_position_of_the_interval);
  Py_CLEAR(clear_module_state->__pyx_n_u_String);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIndex);
  Py_CLEAR(clear_module_state->__pyx_n_u_TabixIndex);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIndex___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIndex___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIndex_fetch);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIterator);
  Py_CLEAR(clear_module_state->__pyx_n_u_TabixIterator);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIterator___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_TabixIterator___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_u_Type);
  Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Type_must_be_None_when_adding_a);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unable_to_delete_END);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unable_to_delete_FORMAT);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unable_to_delete_INFO);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unable_to_update_INFO_values);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unable_to_update_format_values);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_INFO_field);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_allele);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unknown_format_length);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unsupported_FORMAT_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Unsupported_INFO_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_Use_allele_indices_to_set_intege);
  Py_CLEAR(clear_module_state->__pyx_n_u_VARIABLE);
  Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantContig);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantContig);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantContig___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantContig___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantContig_remove_header);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantFile);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_fetch);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_get_reference_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_get_tid);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_is_valid_tid);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_new_record);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_open);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_reset);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_subset_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantFile_write);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeaderContigs);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs___reduce_cy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs___setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_clear_heade);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_remove_head);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderContigs_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeaderMetadata);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata___reduce_c);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata___setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_clear_head);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_remove_hea);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderMetadata_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeaderRecord);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord___get___loca);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord___reduce_cyt);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord___setstate_c);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_remove);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecord_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecords);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeaderRecords);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecords___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecords___reduce_cy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderRecords___setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderSamples);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantHeaderSamples);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderSamples___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderSamples___reduce_cy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderSamples___setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeaderSamples_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_add_line);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_add_meta);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_add_record);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_add_sample);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_add_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_merge);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantHeader_new_record);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantMetadata);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantMetadata);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantMetadata___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantMetadata___setstate_cytho);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantMetadata_remove_header);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecordFilter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter___reduce_cyt);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter___setstate_c);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFilter_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecordFormat);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat___reduce_cyt);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat___setstate_c);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordFormat_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecordInfo);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo___reduce_cytho);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo___setstate_cyt);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordInfo_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecordSample);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample___reduce_cyt);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample___set___loca);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample___setstate_c);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSample_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples);
  Py_CLEAR(clear_module_state->__pyx_n_u_VariantRecordSamples);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples___iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples___reduce_cy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples___setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecordSamples_values);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecord___reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecord___setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecord_copy);
  Py_CLEAR(clear_module_state->__pyx_n_s_VariantRecord_translate);
  Py_CLEAR(clear_module_state->__pyx_kp_b__12);
  Py_CLEAR(clear_module_state->__pyx_kp_u__12);
  Py_CLEAR(clear_module_state->__pyx_kp_u__181);
  Py_CLEAR(clear_module_state->__pyx_kp_b__2);
  Py_CLEAR(clear_module_state->__pyx_kp_u__2);
  Py_CLEAR(clear_module_state->__pyx_kp_b__241);
  Py_CLEAR(clear_module_state->__pyx_n_s__278);
  Py_CLEAR(clear_module_state->__pyx_n_s__323);
  Py_CLEAR(clear_module_state->__pyx_n_s__330);
  Py_CLEAR(clear_module_state->__pyx_kp_b__52);
  Py_CLEAR(clear_module_state->__pyx_kp_u__52);
  Py_CLEAR(clear_module_state->__pyx_kp_u__53);
  Py_CLEAR(clear_module_state->__pyx_n_s_add);
  Py_CLEAR(clear_module_state->__pyx_n_s_add_line);
  Py_CLEAR(clear_module_state->__pyx_n_s_add_meta);
  Py_CLEAR(clear_module_state->__pyx_n_s_add_record);
  Py_CLEAR(clear_module_state->__pyx_n_s_add_sample);
  Py_CLEAR(clear_module_state->__pyx_n_s_add_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_all);
  Py_CLEAR(clear_module_state->__pyx_n_s_alleles);
  Py_CLEAR(clear_module_state->__pyx_n_s_append);
  Py_CLEAR(clear_module_state->__pyx_n_s_arg);
  Py_CLEAR(clear_module_state->__pyx_n_s_args);
  Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
  Py_CLEAR(clear_module_state->__pyx_n_s_bcf);
  Py_CLEAR(clear_module_state->__pyx_kp_u_bcf_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_bcf_array_to_object_locals_genex);
  Py_CLEAR(clear_module_state->__pyx_n_s_bcf_check_values_locals_genexpr);
  Py_CLEAR(clear_module_state->__pyx_kp_u_bcf_hdr_format_failed);
  Py_CLEAR(clear_module_state->__pyx_kp_u_bcf_hdr_set_samples_failed_ret);
  Py_CLEAR(clear_module_state->__pyx_kp_u_bcf_index_required);
  Py_CLEAR(clear_module_state->__pyx_kp_u_bcf_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_bcf_object_to_array_locals_genex);
  Py_CLEAR(clear_module_state->__pyx_n_u_bcguz);
  Py_CLEAR(clear_module_state->__pyx_n_u_bcguz0123456789ex);
  Py_CLEAR(clear_module_state->__pyx_n_s_bgzfp);
  Py_CLEAR(clear_module_state->__pyx_n_s_bkey);
  Py_CLEAR(clear_module_state->__pyx_n_s_bline);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_convert_deleted_record_to);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_create_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_create_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_create_VariantRecordSampl);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_fetch_from_Variantfile_op);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_find_metadata_key);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_iterate_over_Variantfile);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_set_null_allele);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_set_null_alt_allele);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_subset_samples_after_fetc);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_subset_samples_from_Varia);
  Py_CLEAR(clear_module_state->__pyx_kp_u_cannot_write_to_a_Variantfile_op);
  Py_CLEAR(clear_module_state->__pyx_n_s_cfilename);
  Py_CLEAR(clear_module_state->__pyx_n_s_char_array_to_tuple_locals_genex);
  Py_CLEAR(clear_module_state->__pyx_n_s_check_truncation);
  Py_CLEAR(clear_module_state->__pyx_n_s_chr);
  Py_CLEAR(clear_module_state->__pyx_n_s_cindex_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_ckey);
  Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
  Py_CLEAR(clear_module_state->__pyx_n_s_clear);
  Py_CLEAR(clear_module_state->__pyx_n_s_clear_header);
  Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
  Py_CLEAR(clear_module_state->__pyx_n_s_close);
  Py_CLEAR(clear_module_state->__pyx_n_s_cmode);
  Py_CLEAR(clear_module_state->__pyx_n_s_contig);
  Py_CLEAR(clear_module_state->__pyx_n_u_contig);
  Py_CLEAR(clear_module_state->__pyx_kp_u_contig_must_be_specified);
  Py_CLEAR(clear_module_state->__pyx_n_s_copy);
  Py_CLEAR(clear_module_state->__pyx_kp_u_could_not_open_file_mode);
  Py_CLEAR(clear_module_state->__pyx_kp_u_could_not_open_variant_file);
  Py_CLEAR(clear_module_state->__pyx_kp_u_could_not_open_variant_file_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_d);
  Py_CLEAR(clear_module_state->__pyx_n_s_default);
  Py_CLEAR(clear_module_state->__pyx_n_s_description);
  Py_CLEAR(clear_module_state->__pyx_n_s_dict);
  Py_CLEAR(clear_module_state->__pyx_n_s_dict_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
  Py_CLEAR(clear_module_state->__pyx_n_s_drop_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_dst_hdr);
  Py_CLEAR(clear_module_state->__pyx_n_s_dst_header);
  Py_CLEAR(clear_module_state->__pyx_kp_u_dst_header_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_duplicate_filehandle);
  Py_CLEAR(clear_module_state->__pyx_kp_u_either_value_or_items_must_be_sp);
  Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
  Py_CLEAR(clear_module_state->__pyx_n_s_end);
  Py_CLEAR(clear_module_state->__pyx_n_s_endswith);
  Py_CLEAR(clear_module_state->__pyx_n_s_enumerate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_error_in_bcf_subset_format);
  Py_CLEAR(clear_module_state->__pyx_kp_u_error_in_vcf_parse);
  Py_CLEAR(clear_module_state->__pyx_n_s_f);
  Py_CLEAR(clear_module_state->__pyx_n_s_fetch);
  Py_CLEAR(clear_module_state->__pyx_kp_u_fetch_requires_an_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_file_does_not_have_valid_header);
  Py_CLEAR(clear_module_state->__pyx_n_s_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_filter);
  Py_CLEAR(clear_module_state->__pyx_n_s_fmt);
  Py_CLEAR(clear_module_state->__pyx_n_s_format);
  Py_CLEAR(clear_module_state->__pyx_n_s_format_modes);
  Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
  Py_CLEAR(clear_module_state->__pyx_n_s_genexpr);
  Py_CLEAR(clear_module_state->__pyx_kp_u_genotype_is_only_valid_as_a_form);
  Py_CLEAR(clear_module_state->__pyx_n_s_get);
  Py_CLEAR(clear_module_state->__pyx_n_s_get_reference_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_get_tid);
  Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_gz);
  Py_CLEAR(clear_module_state->__pyx_n_s_hash);
  Py_CLEAR(clear_module_state->__pyx_n_s_hdr);
  Py_CLEAR(clear_module_state->__pyx_n_s_header);
  Py_CLEAR(clear_module_state->__pyx_kp_u_header_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_hrec);
  Py_CLEAR(clear_module_state->__pyx_n_s_i);
  Py_CLEAR(clear_module_state->__pyx_n_s_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_idx);
  Py_CLEAR(clear_module_state->__pyx_n_s_ignore_truncation);
  Py_CLEAR(clear_module_state->__pyx_n_s_import);
  Py_CLEAR(clear_module_state->__pyx_n_s_include_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_index);
  Py_CLEAR(clear_module_state->__pyx_n_s_index_filename);
  Py_CLEAR(clear_module_state->__pyx_n_s_info);
  Py_CLEAR(clear_module_state->__pyx_n_s_info_id);
  Py_CLEAR(clear_module_state->__pyx_n_s_init);
  Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_FORMAT);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_character_found);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_contig);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_contig_2);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_contig_id);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_contig_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_filter_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_header_line);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_header_record_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_key);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_metadata_id);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_metadata_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_mode_options);
  Py_CLEAR(clear_module_state->__pyx_n_s_invalid_modes);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_number_of_columns);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_reference_id);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_sample_index);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_sample_name);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_tag);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_value_for_Float_format);
  Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_value_for_Integer_format);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_open);
  Py_CLEAR(clear_module_state->__pyx_n_s_is_valid_tid);
  Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
  Py_CLEAR(clear_module_state->__pyx_n_s_items);
  Py_CLEAR(clear_module_state->__pyx_n_s_iter);
  Py_CLEAR(clear_module_state->__pyx_n_s_iteritems);
  Py_CLEAR(clear_module_state->__pyx_n_s_iterkeys);
  Py_CLEAR(clear_module_state->__pyx_n_s_itervalues);
  Py_CLEAR(clear_module_state->__pyx_n_s_join);
  Py_CLEAR(clear_module_state->__pyx_n_s_k);
  Py_CLEAR(clear_module_state->__pyx_n_s_key);
  Py_CLEAR(clear_module_state->__pyx_n_s_keys);
  Py_CLEAR(clear_module_state->__pyx_n_s_kwargs);
  Py_CLEAR(clear_module_state->__pyx_n_s_length);
  Py_CLEAR(clear_module_state->__pyx_n_u_length);
  Py_CLEAR(clear_module_state->__pyx_kp_u_limits_violated);
  Py_CLEAR(clear_module_state->__pyx_n_s_line);
  Py_CLEAR(clear_module_state->__pyx_n_s_m);
  Py_CLEAR(clear_module_state->__pyx_n_s_main);
  Py_CLEAR(clear_module_state->__pyx_n_s_merge);
  Py_CLEAR(clear_module_state->__pyx_kp_u_missing_d_requested_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_mode);
  Py_CLEAR(clear_module_state->__pyx_kp_u_mode_contains_conflicting_format);
  Py_CLEAR(clear_module_state->__pyx_kp_u_mode_must_begin_with_r_w_or_a);
  Py_CLEAR(clear_module_state->__pyx_n_s_msg);
  Py_CLEAR(clear_module_state->__pyx_kp_u_must_set_at_least_2_alleles);
  Py_CLEAR(clear_module_state->__pyx_n_s_n);
  Py_CLEAR(clear_module_state->__pyx_n_s_name);
  Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_new);
  Py_CLEAR(clear_module_state->__pyx_n_s_new_record);
  Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
  Py_CLEAR(clear_module_state->__pyx_n_s_number);
  Py_CLEAR(clear_module_state->__pyx_n_s_object);
  Py_CLEAR(clear_module_state->__pyx_n_s_open);
  Py_CLEAR(clear_module_state->__pyx_n_s_os);
  Py_CLEAR(clear_module_state->__pyx_n_s_parse_region);
  Py_CLEAR(clear_module_state->__pyx_n_s_phased);
  Py_CLEAR(clear_module_state->__pyx_n_u_phased);
  Py_CLEAR(clear_module_state->__pyx_n_s_pickle);
  Py_CLEAR(clear_module_state->__pyx_n_s_pop);
  Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libcbcf);
  Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libcbcf_pyx);
  Py_CLEAR(clear_module_state->__pyx_n_s_pysam_utils);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_BaseIndex);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantContig);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderCont);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderMeta);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderReco);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderSamp);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantMetadata);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantRecordFilt);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantRecordForm);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantRecordInfo);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantRecordSamp);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_VariantRecordSamp_2);
  Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
  Py_CLEAR(clear_module_state->__pyx_n_s_qual);
  Py_CLEAR(clear_module_state->__pyx_n_s_quoted);
  Py_CLEAR(clear_module_state->__pyx_n_b_r);
  Py_CLEAR(clear_module_state->__pyx_n_s_r);
  Py_CLEAR(clear_module_state->__pyx_n_u_r);
  Py_CLEAR(clear_module_state->__pyx_n_s_range);
  Py_CLEAR(clear_module_state->__pyx_n_s_rec);
  Py_CLEAR(clear_module_state->__pyx_n_s_record);
  Py_CLEAR(clear_module_state->__pyx_kp_u_record_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_records);
  Py_CLEAR(clear_module_state->__pyx_n_s_reduce);
  Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex);
  Py_CLEAR(clear_module_state->__pyx_n_s_ref);
  Py_CLEAR(clear_module_state->__pyx_kp_u_ref_allele_must_not_be_null);
  Py_CLEAR(clear_module_state->__pyx_n_s_reference);
  Py_CLEAR(clear_module_state->__pyx_n_s_region);
  Py_CLEAR(clear_module_state->__pyx_n_s_remap);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove);
  Py_CLEAR(clear_module_state->__pyx_n_s_remove_header);
  Py_CLEAR(clear_module_state->__pyx_n_s_reopen);
  Py_CLEAR(clear_module_state->__pyx_n_s_reset);
  Py_CLEAR(clear_module_state->__pyx_n_s_ret);
  Py_CLEAR(clear_module_state->__pyx_n_s_reversed);
  Py_CLEAR(clear_module_state->__pyx_n_s_rid);
  Py_CLEAR(clear_module_state->__pyx_n_u_rwa);
  Py_CLEAR(clear_module_state->__pyx_n_s_sample);
  Py_CLEAR(clear_module_state->__pyx_kp_u_sample_must_not_be_None);
  Py_CLEAR(clear_module_state->__pyx_n_s_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_seek);
  Py_CLEAR(clear_module_state->__pyx_n_s_self);
  Py_CLEAR(clear_module_state->__pyx_kp_s_self_iter_cannot_be_converted_to);
  Py_CLEAR(clear_module_state->__pyx_kp_s_self_ptr_cannot_be_converted_to);
  Py_CLEAR(clear_module_state->__pyx_n_s_send);
  Py_CLEAR(clear_module_state->__pyx_n_s_setstate);
  Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython);
  Py_CLEAR(clear_module_state->__pyx_n_s_spec);
  Py_CLEAR(clear_module_state->__pyx_n_s_split);
  Py_CLEAR(clear_module_state->__pyx_n_s_src_hdr);
  Py_CLEAR(clear_module_state->__pyx_n_s_start);
  Py_CLEAR(clear_module_state->__pyx_n_s_startswith);
  Py_CLEAR(clear_module_state->__pyx_n_s_state);
  Py_CLEAR(clear_module_state->__pyx_n_s_stop);
  Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource);
  Py_CLEAR(clear_module_state->__pyx_n_s_strip);
  Py_CLEAR(clear_module_state->__pyx_n_s_subset_samples);
  Py_CLEAR(clear_module_state->__pyx_n_s_sys);
  Py_CLEAR(clear_module_state->__pyx_kp_u_tabix_index_required);
  Py_CLEAR(clear_module_state->__pyx_n_s_tell);
  Py_CLEAR(clear_module_state->__pyx_n_s_test);
  Py_CLEAR(clear_module_state->__pyx_kp_u_this_class_cannot_be_instantiate);
  Py_CLEAR(clear_module_state->__pyx_n_s_threads);
  Py_CLEAR(clear_module_state->__pyx_n_s_throw);
  Py_CLEAR(clear_module_state->__pyx_n_s_tid);
  Py_CLEAR(clear_module_state->__pyx_n_s_tidx);
  Py_CLEAR(clear_module_state->__pyx_n_s_translate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_truncated_file);
  Py_CLEAR(clear_module_state->__pyx_n_s_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unable_to_allocate_BCF_record);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unable_to_fetch);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unable_to_fetch_next_record);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unable_to_parse_next_record);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unable_to_reallocate_VariantHead);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_INFO);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_format);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_mode);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unknown_type_specified);
  Py_CLEAR(clear_module_state->__pyx_n_s_unquoted_str);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_header_type_code);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_info_type_code);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_type);
  Py_CLEAR(clear_module_state->__pyx_kp_u_unsupported_types);
  Py_CLEAR(clear_module_state->__pyx_n_s_update);
  Py_CLEAR(clear_module_state->__pyx_n_s_upper);
  Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate);
  Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8);
  Py_CLEAR(clear_module_state->__pyx_n_s_v);
  Py_CLEAR(clear_module_state->__pyx_n_s_value);
  Py_CLEAR(clear_module_state->__pyx_kp_u_value_expected_to_be_scalar_give);
  Py_CLEAR(clear_module_state->__pyx_n_s_values);
  Py_CLEAR(clear_module_state->__pyx_kp_u_values_expected_to_be_tuple_give);
  Py_CLEAR(clear_module_state->__pyx_n_s_vars);
  Py_CLEAR(clear_module_state->__pyx_kp_u_vcf_format_failed);
  Py_CLEAR(clear_module_state->__pyx_n_b_w);
  Py_CLEAR(clear_module_state->__pyx_n_u_w);
  Py_CLEAR(clear_module_state->__pyx_n_u_wb);
  Py_CLEAR(clear_module_state->__pyx_n_u_wb0);
  Py_CLEAR(clear_module_state->__pyx_n_u_wbu);
  Py_CLEAR(clear_module_state->__pyx_n_s_write);
  Py_CLEAR(clear_module_state->__pyx_n_u_wz);
  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);
  Py_CLEAR(clear_module_state->__pyx_k__41);
  Py_CLEAR(clear_module_state->__pyx_k__146);
  Py_CLEAR(clear_module_state->__pyx_k__158);
  Py_CLEAR(clear_module_state->__pyx_k__193);
  Py_CLEAR(clear_module_state->__pyx_k__206);
  Py_CLEAR(clear_module_state->__pyx_tuple_);
  Py_CLEAR(clear_module_state->__pyx_tuple__3);
  Py_CLEAR(clear_module_state->__pyx_tuple__4);
  Py_CLEAR(clear_module_state->__pyx_tuple__5);
  Py_CLEAR(clear_module_state->__pyx_tuple__6);
  Py_CLEAR(clear_module_state->__pyx_tuple__7);
  Py_CLEAR(clear_module_state->__pyx_tuple__8);
  Py_CLEAR(clear_module_state->__pyx_tuple__9);
  Py_CLEAR(clear_module_state->__pyx_tuple__10);
  Py_CLEAR(clear_module_state->__pyx_tuple__11);
  Py_CLEAR(clear_module_state->__pyx_tuple__13);
  Py_CLEAR(clear_module_state->__pyx_tuple__14);
  Py_CLEAR(clear_module_state->__pyx_tuple__15);
  Py_CLEAR(clear_module_state->__pyx_tuple__16);
  Py_CLEAR(clear_module_state->__pyx_tuple__17);
  Py_CLEAR(clear_module_state->__pyx_tuple__18);
  Py_CLEAR(clear_module_state->__pyx_tuple__19);
  Py_CLEAR(clear_module_state->__pyx_tuple__20);
  Py_CLEAR(clear_module_state->__pyx_tuple__21);
  Py_CLEAR(clear_module_state->__pyx_tuple__22);
  Py_CLEAR(clear_module_state->__pyx_tuple__23);
  Py_CLEAR(clear_module_state->__pyx_tuple__24);
  Py_CLEAR(clear_module_state->__pyx_tuple__25);
  Py_CLEAR(clear_module_state->__pyx_tuple__26);
  Py_CLEAR(clear_module_state->__pyx_tuple__27);
  Py_CLEAR(clear_module_state->__pyx_tuple__28);
  Py_CLEAR(clear_module_state->__pyx_tuple__29);
  Py_CLEAR(clear_module_state->__pyx_tuple__30);
  Py_CLEAR(clear_module_state->__pyx_tuple__31);
  Py_CLEAR(clear_module_state->__pyx_tuple__32);
  Py_CLEAR(clear_module_state->__pyx_tuple__43);
  Py_CLEAR(clear_module_state->__pyx_tuple__47);
  Py_CLEAR(clear_module_state->__pyx_tuple__48);
  Py_CLEAR(clear_module_state->__pyx_tuple__51);
  Py_CLEAR(clear_module_state->__pyx_tuple__57);
  Py_CLEAR(clear_module_state->__pyx_tuple__58);
  Py_CLEAR(clear_module_state->__pyx_tuple__60);
  Py_CLEAR(clear_module_state->__pyx_tuple__61);
  Py_CLEAR(clear_module_state->__pyx_tuple__76);
  Py_CLEAR(clear_module_state->__pyx_tuple__77);
  Py_CLEAR(clear_module_state->__pyx_tuple__88);
  Py_CLEAR(clear_module_state->__pyx_tuple__91);
  Py_CLEAR(clear_module_state->__pyx_tuple__95);
  Py_CLEAR(clear_module_state->__pyx_tuple__98);
  Py_CLEAR(clear_module_state->__pyx_slice__240);
  Py_CLEAR(clear_module_state->__pyx_tuple__100);
  Py_CLEAR(clear_module_state->__pyx_tuple__103);
  Py_CLEAR(clear_module_state->__pyx_tuple__105);
  Py_CLEAR(clear_module_state->__pyx_tuple__106);
  Py_CLEAR(clear_module_state->__pyx_tuple__111);
  Py_CLEAR(clear_module_state->__pyx_tuple__123);
  Py_CLEAR(clear_module_state->__pyx_tuple__124);
  Py_CLEAR(clear_module_state->__pyx_tuple__135);
  Py_CLEAR(clear_module_state->__pyx_tuple__136);
  Py_CLEAR(clear_module_state->__pyx_tuple__164);
  Py_CLEAR(clear_module_state->__pyx_tuple__165);
  Py_CLEAR(clear_module_state->__pyx_tuple__166);
  Py_CLEAR(clear_module_state->__pyx_tuple__167);
  Py_CLEAR(clear_module_state->__pyx_tuple__168);
  Py_CLEAR(clear_module_state->__pyx_tuple__169);
  Py_CLEAR(clear_module_state->__pyx_tuple__170);
  Py_CLEAR(clear_module_state->__pyx_tuple__171);
  Py_CLEAR(clear_module_state->__pyx_tuple__172);
  Py_CLEAR(clear_module_state->__pyx_tuple__173);
  Py_CLEAR(clear_module_state->__pyx_tuple__174);
  Py_CLEAR(clear_module_state->__pyx_tuple__175);
  Py_CLEAR(clear_module_state->__pyx_tuple__176);
  Py_CLEAR(clear_module_state->__pyx_tuple__177);
  Py_CLEAR(clear_module_state->__pyx_tuple__180);
  Py_CLEAR(clear_module_state->__pyx_tuple__182);
  Py_CLEAR(clear_module_state->__pyx_tuple__183);
  Py_CLEAR(clear_module_state->__pyx_tuple__197);
  Py_CLEAR(clear_module_state->__pyx_tuple__210);
  Py_CLEAR(clear_module_state->__pyx_tuple__219);
  Py_CLEAR(clear_module_state->__pyx_tuple__220);
  Py_CLEAR(clear_module_state->__pyx_tuple__221);
  Py_CLEAR(clear_module_state->__pyx_tuple__222);
  Py_CLEAR(clear_module_state->__pyx_tuple__223);
  Py_CLEAR(clear_module_state->__pyx_tuple__224);
  Py_CLEAR(clear_module_state->__pyx_tuple__227);
  Py_CLEAR(clear_module_state->__pyx_tuple__228);
  Py_CLEAR(clear_module_state->__pyx_tuple__232);
  Py_CLEAR(clear_module_state->__pyx_tuple__233);
  Py_CLEAR(clear_module_state->__pyx_tuple__234);
  Py_CLEAR(clear_module_state->__pyx_tuple__236);
  Py_CLEAR(clear_module_state->__pyx_tuple__238);
  Py_CLEAR(clear_module_state->__pyx_tuple__239);
  Py_CLEAR(clear_module_state->__pyx_tuple__242);
  Py_CLEAR(clear_module_state->__pyx_tuple__247);
  Py_CLEAR(clear_module_state->__pyx_tuple__249);
  Py_CLEAR(clear_module_state->__pyx_tuple__250);
  Py_CLEAR(clear_module_state->__pyx_tuple__253);
  Py_CLEAR(clear_module_state->__pyx_tuple__255);
  Py_CLEAR(clear_module_state->__pyx_tuple__256);
  Py_CLEAR(clear_module_state->__pyx_tuple__260);
  Py_CLEAR(clear_module_state->__pyx_tuple__262);
  Py_CLEAR(clear_module_state->__pyx_tuple__264);
  Py_CLEAR(clear_module_state->__pyx_tuple__266);
  Py_CLEAR(clear_module_state->__pyx_tuple__270);
  Py_CLEAR(clear_module_state->__pyx_tuple__275);
  Py_CLEAR(clear_module_state->__pyx_tuple__277);
  Py_CLEAR(clear_module_state->__pyx_tuple__279);
  Py_CLEAR(clear_module_state->__pyx_tuple__280);
  Py_CLEAR(clear_module_state->__pyx_tuple__281);
  Py_CLEAR(clear_module_state->__pyx_tuple__282);
  Py_CLEAR(clear_module_state->__pyx_tuple__283);
  Py_CLEAR(clear_module_state->__pyx_tuple__284);
  Py_CLEAR(clear_module_state->__pyx_tuple__285);
  Py_CLEAR(clear_module_state->__pyx_tuple__286);
  Py_CLEAR(clear_module_state->__pyx_tuple__287);
  Py_CLEAR(clear_module_state->__pyx_tuple__288);
  Py_CLEAR(clear_module_state->__pyx_tuple__289);
  Py_CLEAR(clear_module_state->__pyx_tuple__290);
  Py_CLEAR(clear_module_state->__pyx_tuple__291);
  Py_CLEAR(clear_module_state->__pyx_tuple__292);
  Py_CLEAR(clear_module_state->__pyx_tuple__293);
  Py_CLEAR(clear_module_state->__pyx_tuple__294);
  Py_CLEAR(clear_module_state->__pyx_tuple__295);
  Py_CLEAR(clear_module_state->__pyx_tuple__296);
  Py_CLEAR(clear_module_state->__pyx_tuple__297);
  Py_CLEAR(clear_module_state->__pyx_tuple__298);
  Py_CLEAR(clear_module_state->__pyx_tuple__299);
  Py_CLEAR(clear_module_state->__pyx_tuple__300);
  Py_CLEAR(clear_module_state->__pyx_tuple__301);
  Py_CLEAR(clear_module_state->__pyx_tuple__302);
  Py_CLEAR(clear_module_state->__pyx_tuple__303);
  Py_CLEAR(clear_module_state->__pyx_tuple__304);
  Py_CLEAR(clear_module_state->__pyx_tuple__305);
  Py_CLEAR(clear_module_state->__pyx_tuple__306);
  Py_CLEAR(clear_module_state->__pyx_tuple__307);
  Py_CLEAR(clear_module_state->__pyx_tuple__308);
  Py_CLEAR(clear_module_state->__pyx_tuple__309);
  Py_CLEAR(clear_module_state->__pyx_tuple__310);
  Py_CLEAR(clear_module_state->__pyx_tuple__311);
  Py_CLEAR(clear_module_state->__pyx_tuple__312);
  Py_CLEAR(clear_module_state->__pyx_tuple__313);
  Py_CLEAR(clear_module_state->__pyx_tuple__314);
  Py_CLEAR(clear_module_state->__pyx_tuple__315);
  Py_CLEAR(clear_module_state->__pyx_tuple__316);
  Py_CLEAR(clear_module_state->__pyx_tuple__317);
  Py_CLEAR(clear_module_state->__pyx_tuple__318);
  Py_CLEAR(clear_module_state->__pyx_tuple__319);
  Py_CLEAR(clear_module_state->__pyx_tuple__320);
  Py_CLEAR(clear_module_state->__pyx_tuple__321);
  Py_CLEAR(clear_module_state->__pyx_tuple__322);
  Py_CLEAR(clear_module_state->__pyx_tuple__324);
  Py_CLEAR(clear_module_state->__pyx_tuple__325);
  Py_CLEAR(clear_module_state->__pyx_tuple__326);
  Py_CLEAR(clear_module_state->__pyx_tuple__327);
  Py_CLEAR(clear_module_state->__pyx_tuple__328);
  Py_CLEAR(clear_module_state->__pyx_tuple__329);
  Py_CLEAR(clear_module_state->__pyx_codeobj__33);
  Py_CLEAR(clear_module_state->__pyx_codeobj__34);
  Py_CLEAR(clear_module_state->__pyx_codeobj__35);
  Py_CLEAR(clear_module_state->__pyx_codeobj__36);
  Py_CLEAR(clear_module_state->__pyx_codeobj__37);
  Py_CLEAR(clear_module_state->__pyx_codeobj__38);
  Py_CLEAR(clear_module_state->__pyx_codeobj__39);
  Py_CLEAR(clear_module_state->__pyx_codeobj__40);
  Py_CLEAR(clear_module_state->__pyx_codeobj__42);
  Py_CLEAR(clear_module_state->__pyx_codeobj__44);
  Py_CLEAR(clear_module_state->__pyx_codeobj__45);
  Py_CLEAR(clear_module_state->__pyx_codeobj__46);
  Py_CLEAR(clear_module_state->__pyx_codeobj__49);
  Py_CLEAR(clear_module_state->__pyx_codeobj__50);
  Py_CLEAR(clear_module_state->__pyx_codeobj__54);
  Py_CLEAR(clear_module_state->__pyx_codeobj__55);
  Py_CLEAR(clear_module_state->__pyx_codeobj__56);
  Py_CLEAR(clear_module_state->__pyx_codeobj__59);
  Py_CLEAR(clear_module_state->__pyx_codeobj__62);
  Py_CLEAR(clear_module_state->__pyx_codeobj__63);
  Py_CLEAR(clear_module_state->__pyx_codeobj__64);
  Py_CLEAR(clear_module_state->__pyx_codeobj__65);
  Py_CLEAR(clear_module_state->__pyx_codeobj__66);
  Py_CLEAR(clear_module_state->__pyx_codeobj__67);
  Py_CLEAR(clear_module_state->__pyx_codeobj__68);
  Py_CLEAR(clear_module_state->__pyx_codeobj__69);
  Py_CLEAR(clear_module_state->__pyx_codeobj__70);
  Py_CLEAR(clear_module_state->__pyx_codeobj__71);
  Py_CLEAR(clear_module_state->__pyx_codeobj__72);
  Py_CLEAR(clear_module_state->__pyx_codeobj__73);
  Py_CLEAR(clear_module_state->__pyx_codeobj__74);
  Py_CLEAR(clear_module_state->__pyx_codeobj__75);
  Py_CLEAR(clear_module_state->__pyx_codeobj__78);
  Py_CLEAR(clear_module_state->__pyx_codeobj__79);
  Py_CLEAR(clear_module_state->__pyx_codeobj__80);
  Py_CLEAR(clear_module_state->__pyx_codeobj__81);
  Py_CLEAR(clear_module_state->__pyx_codeobj__82);
  Py_CLEAR(clear_module_state->__pyx_codeobj__83);
  Py_CLEAR(clear_module_state->__pyx_codeobj__84);
  Py_CLEAR(clear_module_state->__pyx_codeobj__85);
  Py_CLEAR(clear_module_state->__pyx_codeobj__86);
  Py_CLEAR(clear_module_state->__pyx_codeobj__87);
  Py_CLEAR(clear_module_state->__pyx_codeobj__89);
  Py_CLEAR(clear_module_state->__pyx_codeobj__90);
  Py_CLEAR(clear_module_state->__pyx_codeobj__92);
  Py_CLEAR(clear_module_state->__pyx_codeobj__93);
  Py_CLEAR(clear_module_state->__pyx_codeobj__94);
  Py_CLEAR(clear_module_state->__pyx_codeobj__96);
  Py_CLEAR(clear_module_state->__pyx_codeobj__97);
  Py_CLEAR(clear_module_state->__pyx_codeobj__99);
  Py_CLEAR(clear_module_state->__pyx_codeobj__101);
  Py_CLEAR(clear_module_state->__pyx_codeobj__102);
  Py_CLEAR(clear_module_state->__pyx_codeobj__104);
  Py_CLEAR(clear_module_state->__pyx_codeobj__107);
  Py_CLEAR(clear_module_state->__pyx_codeobj__108);
  Py_CLEAR(clear_module_state->__pyx_codeobj__109);
  Py_CLEAR(clear_module_state->__pyx_codeobj__110);
  Py_CLEAR(clear_module_state->__pyx_codeobj__112);
  Py_CLEAR(clear_module_state->__pyx_codeobj__113);
  Py_CLEAR(clear_module_state->__pyx_codeobj__114);
  Py_CLEAR(clear_module_state->__pyx_codeobj__115);
  Py_CLEAR(clear_module_state->__pyx_codeobj__116);
  Py_CLEAR(clear_module_state->__pyx_codeobj__117);
  Py_CLEAR(clear_module_state->__pyx_codeobj__118);
  Py_CLEAR(clear_module_state->__pyx_codeobj__119);
  Py_CLEAR(clear_module_state->__pyx_codeobj__120);
  Py_CLEAR(clear_module_state->__pyx_codeobj__121);
  Py_CLEAR(clear_module_state->__pyx_codeobj__122);
  Py_CLEAR(clear_module_state->__pyx_codeobj__125);
  Py_CLEAR(clear_module_state->__pyx_codeobj__126);
  Py_CLEAR(clear_module_state->__pyx_codeobj__127);
  Py_CLEAR(clear_module_state->__pyx_codeobj__128);
  Py_CLEAR(clear_module_state->__pyx_codeobj__129);
  Py_CLEAR(clear_module_state->__pyx_codeobj__130);
  Py_CLEAR(clear_module_state->__pyx_codeobj__131);
  Py_CLEAR(clear_module_state->__pyx_codeobj__132);
  Py_CLEAR(clear_module_state->__pyx_codeobj__133);
  Py_CLEAR(clear_module_state->__pyx_codeobj__134);
  Py_CLEAR(clear_module_state->__pyx_codeobj__137);
  Py_CLEAR(clear_module_state->__pyx_codeobj__138);
  Py_CLEAR(clear_module_state->__pyx_codeobj__139);
  Py_CLEAR(clear_module_state->__pyx_codeobj__140);
  Py_CLEAR(clear_module_state->__pyx_codeobj__141);
  Py_CLEAR(clear_module_state->__pyx_codeobj__142);
  Py_CLEAR(clear_module_state->__pyx_codeobj__143);
  Py_CLEAR(clear_module_state->__pyx_codeobj__144);
  Py_CLEAR(clear_module_state->__pyx_codeobj__145);
  Py_CLEAR(clear_module_state->__pyx_codeobj__147);
  Py_CLEAR(clear_module_state->__pyx_codeobj__148);
  Py_CLEAR(clear_module_state->__pyx_codeobj__149);
  Py_CLEAR(clear_module_state->__pyx_codeobj__150);
  Py_CLEAR(clear_module_state->__pyx_codeobj__151);
  Py_CLEAR(clear_module_state->__pyx_codeobj__152);
  Py_CLEAR(clear_module_state->__pyx_codeobj__153);
  Py_CLEAR(clear_module_state->__pyx_codeobj__154);
  Py_CLEAR(clear_module_state->__pyx_codeobj__155);
  Py_CLEAR(clear_module_state->__pyx_codeobj__156);
  Py_CLEAR(clear_module_state->__pyx_codeobj__157);
  Py_CLEAR(clear_module_state->__pyx_codeobj__159);
  Py_CLEAR(clear_module_state->__pyx_codeobj__160);
  Py_CLEAR(clear_module_state->__pyx_codeobj__161);
  Py_CLEAR(clear_module_state->__pyx_codeobj__162);
  Py_CLEAR(clear_module_state->__pyx_codeobj__163);
  Py_CLEAR(clear_module_state->__pyx_codeobj__178);
  Py_CLEAR(clear_module_state->__pyx_codeobj__179);
  Py_CLEAR(clear_module_state->__pyx_codeobj__184);
  Py_CLEAR(clear_module_state->__pyx_codeobj__185);
  Py_CLEAR(clear_module_state->__pyx_codeobj__186);
  Py_CLEAR(clear_module_state->__pyx_codeobj__187);
  Py_CLEAR(clear_module_state->__pyx_codeobj__188);
  Py_CLEAR(clear_module_state->__pyx_codeobj__189);
  Py_CLEAR(clear_module_state->__pyx_codeobj__190);
  Py_CLEAR(clear_module_state->__pyx_codeobj__191);
  Py_CLEAR(clear_module_state->__pyx_codeobj__192);
  Py_CLEAR(clear_module_state->__pyx_codeobj__194);
  Py_CLEAR(clear_module_state->__pyx_codeobj__195);
  Py_CLEAR(clear_module_state->__pyx_codeobj__196);
  Py_CLEAR(clear_module_state->__pyx_codeobj__198);
  Py_CLEAR(clear_module_state->__pyx_codeobj__199);
  Py_CLEAR(clear_module_state->__pyx_codeobj__200);
  Py_CLEAR(clear_module_state->__pyx_codeobj__201);
  Py_CLEAR(clear_module_state->__pyx_codeobj__202);
  Py_CLEAR(clear_module_state->__pyx_codeobj__203);
  Py_CLEAR(clear_module_state->__pyx_codeobj__204);
  Py_CLEAR(clear_module_state->__pyx_codeobj__205);
  Py_CLEAR(clear_module_state->__pyx_codeobj__207);
  Py_CLEAR(clear_module_state->__pyx_codeobj__208);
  Py_CLEAR(clear_module_state->__pyx_codeobj__209);
  Py_CLEAR(clear_module_state->__pyx_codeobj__211);
  Py_CLEAR(clear_module_state->__pyx_codeobj__212);
  Py_CLEAR(clear_module_state->__pyx_codeobj__213);
  Py_CLEAR(clear_module_state->__pyx_codeobj__214);
  Py_CLEAR(clear_module_state->__pyx_codeobj__215);
  Py_CLEAR(clear_module_state->__pyx_codeobj__216);
  Py_CLEAR(clear_module_state->__pyx_codeobj__217);
  Py_CLEAR(clear_module_state->__pyx_codeobj__218);
  Py_CLEAR(clear_module_state->__pyx_codeobj__225);
  Py_CLEAR(clear_module_state->__pyx_codeobj__226);
  Py_CLEAR(clear_module_state->__pyx_codeobj__229);
  Py_CLEAR(clear_module_state->__pyx_codeobj__230);
  Py_CLEAR(clear_module_state->__pyx_codeobj__231);
  Py_CLEAR(clear_module_state->__pyx_codeobj__235);
  Py_CLEAR(clear_module_state->__pyx_codeobj__237);
  Py_CLEAR(clear_module_state->__pyx_codeobj__243);
  Py_CLEAR(clear_module_state->__pyx_codeobj__244);
  Py_CLEAR(clear_module_state->__pyx_codeobj__245);
  Py_CLEAR(clear_module_state->__pyx_codeobj__246);
  Py_CLEAR(clear_module_state->__pyx_codeobj__248);
  Py_CLEAR(clear_module_state->__pyx_codeobj__251);
  Py_CLEAR(clear_module_state->__pyx_codeobj__252);
  Py_CLEAR(clear_module_state->__pyx_codeobj__254);
  Py_CLEAR(clear_module_state->__pyx_codeobj__257);
  Py_CLEAR(clear_module_state->__pyx_codeobj__258);
  Py_CLEAR(clear_module_state->__pyx_codeobj__259);
  Py_CLEAR(clear_module_state->__pyx_codeobj__261);
  Py_CLEAR(clear_module_state->__pyx_codeobj__263);
  Py_CLEAR(clear_module_state->__pyx_codeobj__265);
  Py_CLEAR(clear_module_state->__pyx_codeobj__267);
  Py_CLEAR(clear_module_state->__pyx_codeobj__268);
  Py_CLEAR(clear_module_state->__pyx_codeobj__269);
  Py_CLEAR(clear_module_state->__pyx_codeobj__271);
  Py_CLEAR(clear_module_state->__pyx_codeobj__272);
  Py_CLEAR(clear_module_state->__pyx_codeobj__273);
  Py_CLEAR(clear_module_state->__pyx_codeobj__274);
  Py_CLEAR(clear_module_state->__pyx_codeobj__276);
  return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstate *traverse_module_state = __pyx_mstate(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);
  Py_VISIT(traverse_module_state->__pyx_empty_tuple);
  Py_VISIT(traverse_module_state->__pyx_empty_bytes);
  Py_VISIT(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_n_u_A);
  Py_VISIT(traverse_module_state->__pyx_n_u_ALT);
  Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIndex);
  Py_VISIT(traverse_module_state->__pyx_n_u_BCFIndex);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIndex___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIndex___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIndex_fetch);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIterator);
  Py_VISIT(traverse_module_state->__pyx_n_u_BCFIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIterator___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BCFIterator___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_u_BND);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex);
  Py_VISIT(traverse_module_state->__pyx_n_u_BaseIndex);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIndex_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIterator);
  Py_VISIT(traverse_module_state->__pyx_n_u_BaseIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIterator___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_BaseIterator___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_u_CONTIG);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_add_extra_threads_when_ig);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_copy_arrays_with_src_valu);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_create_empty_array);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_re_open_htsfile);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_set_phased_before_genotyp);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_specify_an_index_filename);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_translate_record_Number_o);
  Py_VISIT(traverse_module_state->__pyx_n_u_Description);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Duplicated_sample_name);
  Py_VISIT(traverse_module_state->__pyx_n_b_END);
  Py_VISIT(traverse_module_state->__pyx_n_u_END);
  Py_VISIT(traverse_module_state->__pyx_kp_u_END_is_a_reserved_attribute_acce);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_extracting_ID);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_s_reading_record);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_unpacking_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_updating_alleles);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Error_updating_id);
  Py_VISIT(traverse_module_state->__pyx_n_u_FILTER);
  Py_VISIT(traverse_module_state->__pyx_n_u_FIXED);
  Py_VISIT(traverse_module_state->__pyx_n_u_FORMAT);
  Py_VISIT(traverse_module_state->__pyx_n_u_Flag);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Flag_types_are_not_allowed_on_FO);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Flag_values_must_be_True_False_N);
  Py_VISIT(traverse_module_state->__pyx_n_u_Float);
  Py_VISIT(traverse_module_state->__pyx_n_u_G);
  Py_VISIT(traverse_module_state->__pyx_n_u_GENERIC);
  Py_VISIT(traverse_module_state->__pyx_n_u_GT);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Header_already_exists_for_contig);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Header_already_exists_for_id);
  Py_VISIT(traverse_module_state->__pyx_n_u_ID);
  Py_VISIT(traverse_module_state->__pyx_n_u_INDEL);
  Py_VISIT(traverse_module_state->__pyx_n_u_INFO);
  Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_I_O_operation_on_closed_file);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6);
  Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7);
  Py_VISIT(traverse_module_state->__pyx_n_s_IndexError);
  Py_VISIT(traverse_module_state->__pyx_n_u_Integer);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Integer_value_too_small_large_to);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_INFO_field);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_VariantRecord_Number_of);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_allele_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_chromosome_contig);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_filter);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_header);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_header_id);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_header_record_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_index_object);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_tid);
  Py_VISIT(traverse_module_state->__pyx_n_s_KeyError);
  Py_VISIT(traverse_module_state->__pyx_n_u_MNP);
  Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_NON_REF);
  Py_VISIT(traverse_module_state->__pyx_n_s_NotImplemented);
  Py_VISIT(traverse_module_state->__pyx_n_u_Number);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Number_must_be_None_when_adding);
  Py_VISIT(traverse_module_state->__pyx_n_u_OTHER);
  Py_VISIT(traverse_module_state->__pyx_n_u_OVERLAP);
  Py_VISIT(traverse_module_state->__pyx_kp_u_One_or_more_of_the_supplied_samp);
  Py_VISIT(traverse_module_state->__pyx_n_u_PASS);
  Py_VISIT(traverse_module_state->__pyx_n_s_PickleError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Position_must_be_positive);
  Py_VISIT(traverse_module_state->__pyx_n_u_R);
  Py_VISIT(traverse_module_state->__pyx_n_u_REF);
  Py_VISIT(traverse_module_state->__pyx_n_u_SNP);
  Py_VISIT(traverse_module_state->__pyx_n_u_STRUCTURED);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Start_coordinate_must_be_non_neg);
  Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Stop_coordinate_must_be_non_nega);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Stop_position_of_the_interval);
  Py_VISIT(traverse_module_state->__pyx_n_u_String);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIndex);
  Py_VISIT(traverse_module_state->__pyx_n_u_TabixIndex);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIndex___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIndex___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIndex_fetch);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIterator);
  Py_VISIT(traverse_module_state->__pyx_n_u_TabixIterator);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIterator___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_TabixIterator___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_u_Type);
  Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Type_must_be_None_when_adding_a);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unable_to_delete_END);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unable_to_delete_FORMAT);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unable_to_delete_INFO);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unable_to_update_INFO_values);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unable_to_update_format_values);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_INFO_field);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_allele);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unknown_format_length);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unsupported_FORMAT_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Unsupported_INFO_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_Use_allele_indices_to_set_intege);
  Py_VISIT(traverse_module_state->__pyx_n_u_VARIABLE);
  Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantContig);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantContig);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantContig___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantContig___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantContig_remove_header);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantFile);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_fetch);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_get_reference_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_get_tid);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_is_valid_tid);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_new_record);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_open);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_reset);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_subset_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantFile_write);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeaderContigs);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs___reduce_cy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs___setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_clear_heade);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_remove_head);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderContigs_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeaderMetadata);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata___reduce_c);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata___setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_clear_head);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_remove_hea);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderMetadata_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeaderRecord);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord___get___loca);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord___reduce_cyt);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord___setstate_c);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_remove);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecord_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecords);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeaderRecords);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecords___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecords___reduce_cy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderRecords___setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderSamples);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantHeaderSamples);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderSamples___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderSamples___reduce_cy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderSamples___setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeaderSamples_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_add_line);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_add_meta);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_add_record);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_add_sample);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_add_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_merge);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantHeader_new_record);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantMetadata);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantMetadata);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantMetadata___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantMetadata___setstate_cytho);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantMetadata_remove_header);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecordFilter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter___reduce_cyt);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter___setstate_c);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFilter_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecordFormat);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat___reduce_cyt);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat___setstate_c);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordFormat_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecordInfo);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo___reduce_cytho);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo___setstate_cyt);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordInfo_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecordSample);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample___reduce_cyt);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample___set___loca);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample___setstate_c);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSample_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples);
  Py_VISIT(traverse_module_state->__pyx_n_u_VariantRecordSamples);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples___iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples___reduce_cy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples___setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecordSamples_values);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecord___reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecord___setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecord_copy);
  Py_VISIT(traverse_module_state->__pyx_n_s_VariantRecord_translate);
  Py_VISIT(traverse_module_state->__pyx_kp_b__12);
  Py_VISIT(traverse_module_state->__pyx_kp_u__12);
  Py_VISIT(traverse_module_state->__pyx_kp_u__181);
  Py_VISIT(traverse_module_state->__pyx_kp_b__2);
  Py_VISIT(traverse_module_state->__pyx_kp_u__2);
  Py_VISIT(traverse_module_state->__pyx_kp_b__241);
  Py_VISIT(traverse_module_state->__pyx_n_s__278);
  Py_VISIT(traverse_module_state->__pyx_n_s__323);
  Py_VISIT(traverse_module_state->__pyx_n_s__330);
  Py_VISIT(traverse_module_state->__pyx_kp_b__52);
  Py_VISIT(traverse_module_state->__pyx_kp_u__52);
  Py_VISIT(traverse_module_state->__pyx_kp_u__53);
  Py_VISIT(traverse_module_state->__pyx_n_s_add);
  Py_VISIT(traverse_module_state->__pyx_n_s_add_line);
  Py_VISIT(traverse_module_state->__pyx_n_s_add_meta);
  Py_VISIT(traverse_module_state->__pyx_n_s_add_record);
  Py_VISIT(traverse_module_state->__pyx_n_s_add_sample);
  Py_VISIT(traverse_module_state->__pyx_n_s_add_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_all);
  Py_VISIT(traverse_module_state->__pyx_n_s_alleles);
  Py_VISIT(traverse_module_state->__pyx_n_s_append);
  Py_VISIT(traverse_module_state->__pyx_n_s_arg);
  Py_VISIT(traverse_module_state->__pyx_n_s_args);
  Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
  Py_VISIT(traverse_module_state->__pyx_n_s_bcf);
  Py_VISIT(traverse_module_state->__pyx_kp_u_bcf_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_bcf_array_to_object_locals_genex);
  Py_VISIT(traverse_module_state->__pyx_n_s_bcf_check_values_locals_genexpr);
  Py_VISIT(traverse_module_state->__pyx_kp_u_bcf_hdr_format_failed);
  Py_VISIT(traverse_module_state->__pyx_kp_u_bcf_hdr_set_samples_failed_ret);
  Py_VISIT(traverse_module_state->__pyx_kp_u_bcf_index_required);
  Py_VISIT(traverse_module_state->__pyx_kp_u_bcf_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_bcf_object_to_array_locals_genex);
  Py_VISIT(traverse_module_state->__pyx_n_u_bcguz);
  Py_VISIT(traverse_module_state->__pyx_n_u_bcguz0123456789ex);
  Py_VISIT(traverse_module_state->__pyx_n_s_bgzfp);
  Py_VISIT(traverse_module_state->__pyx_n_s_bkey);
  Py_VISIT(traverse_module_state->__pyx_n_s_bline);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_convert_deleted_record_to);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_create_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_create_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_create_VariantRecordSampl);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_fetch_from_Variantfile_op);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_find_metadata_key);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_iterate_over_Variantfile);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_set_null_allele);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_set_null_alt_allele);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_subset_samples_after_fetc);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_subset_samples_from_Varia);
  Py_VISIT(traverse_module_state->__pyx_kp_u_cannot_write_to_a_Variantfile_op);
  Py_VISIT(traverse_module_state->__pyx_n_s_cfilename);
  Py_VISIT(traverse_module_state->__pyx_n_s_char_array_to_tuple_locals_genex);
  Py_VISIT(traverse_module_state->__pyx_n_s_check_truncation);
  Py_VISIT(traverse_module_state->__pyx_n_s_chr);
  Py_VISIT(traverse_module_state->__pyx_n_s_cindex_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_ckey);
  Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
  Py_VISIT(traverse_module_state->__pyx_n_s_clear);
  Py_VISIT(traverse_module_state->__pyx_n_s_clear_header);
  Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
  Py_VISIT(traverse_module_state->__pyx_n_s_close);
  Py_VISIT(traverse_module_state->__pyx_n_s_cmode);
  Py_VISIT(traverse_module_state->__pyx_n_s_contig);
  Py_VISIT(traverse_module_state->__pyx_n_u_contig);
  Py_VISIT(traverse_module_state->__pyx_kp_u_contig_must_be_specified);
  Py_VISIT(traverse_module_state->__pyx_n_s_copy);
  Py_VISIT(traverse_module_state->__pyx_kp_u_could_not_open_file_mode);
  Py_VISIT(traverse_module_state->__pyx_kp_u_could_not_open_variant_file);
  Py_VISIT(traverse_module_state->__pyx_kp_u_could_not_open_variant_file_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_d);
  Py_VISIT(traverse_module_state->__pyx_n_s_default);
  Py_VISIT(traverse_module_state->__pyx_n_s_description);
  Py_VISIT(traverse_module_state->__pyx_n_s_dict);
  Py_VISIT(traverse_module_state->__pyx_n_s_dict_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
  Py_VISIT(traverse_module_state->__pyx_n_s_drop_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_dst_hdr);
  Py_VISIT(traverse_module_state->__pyx_n_s_dst_header);
  Py_VISIT(traverse_module_state->__pyx_kp_u_dst_header_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_duplicate_filehandle);
  Py_VISIT(traverse_module_state->__pyx_kp_u_either_value_or_items_must_be_sp);
  Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
  Py_VISIT(traverse_module_state->__pyx_n_s_end);
  Py_VISIT(traverse_module_state->__pyx_n_s_endswith);
  Py_VISIT(traverse_module_state->__pyx_n_s_enumerate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_error_in_bcf_subset_format);
  Py_VISIT(traverse_module_state->__pyx_kp_u_error_in_vcf_parse);
  Py_VISIT(traverse_module_state->__pyx_n_s_f);
  Py_VISIT(traverse_module_state->__pyx_n_s_fetch);
  Py_VISIT(traverse_module_state->__pyx_kp_u_fetch_requires_an_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_file_does_not_have_valid_header);
  Py_VISIT(traverse_module_state->__pyx_n_s_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_filter);
  Py_VISIT(traverse_module_state->__pyx_n_s_fmt);
  Py_VISIT(traverse_module_state->__pyx_n_s_format);
  Py_VISIT(traverse_module_state->__pyx_n_s_format_modes);
  Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
  Py_VISIT(traverse_module_state->__pyx_n_s_genexpr);
  Py_VISIT(traverse_module_state->__pyx_kp_u_genotype_is_only_valid_as_a_form);
  Py_VISIT(traverse_module_state->__pyx_n_s_get);
  Py_VISIT(traverse_module_state->__pyx_n_s_get_reference_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_get_tid);
  Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_gz);
  Py_VISIT(traverse_module_state->__pyx_n_s_hash);
  Py_VISIT(traverse_module_state->__pyx_n_s_hdr);
  Py_VISIT(traverse_module_state->__pyx_n_s_header);
  Py_VISIT(traverse_module_state->__pyx_kp_u_header_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_hrec);
  Py_VISIT(traverse_module_state->__pyx_n_s_i);
  Py_VISIT(traverse_module_state->__pyx_n_s_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_idx);
  Py_VISIT(traverse_module_state->__pyx_n_s_ignore_truncation);
  Py_VISIT(traverse_module_state->__pyx_n_s_import);
  Py_VISIT(traverse_module_state->__pyx_n_s_include_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_index);
  Py_VISIT(traverse_module_state->__pyx_n_s_index_filename);
  Py_VISIT(traverse_module_state->__pyx_n_s_info);
  Py_VISIT(traverse_module_state->__pyx_n_s_info_id);
  Py_VISIT(traverse_module_state->__pyx_n_s_init);
  Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_FORMAT);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_character_found);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_contig);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_contig_2);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_contig_id);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_contig_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_filter_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_header_line);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_header_record_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_key);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_metadata_id);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_metadata_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_mode_options);
  Py_VISIT(traverse_module_state->__pyx_n_s_invalid_modes);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_number_of_columns);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_reference_id);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_sample_index);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_sample_name);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_tag);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_value_for_Float_format);
  Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_value_for_Integer_format);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_open);
  Py_VISIT(traverse_module_state->__pyx_n_s_is_valid_tid);
  Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
  Py_VISIT(traverse_module_state->__pyx_n_s_items);
  Py_VISIT(traverse_module_state->__pyx_n_s_iter);
  Py_VISIT(traverse_module_state->__pyx_n_s_iteritems);
  Py_VISIT(traverse_module_state->__pyx_n_s_iterkeys);
  Py_VISIT(traverse_module_state->__pyx_n_s_itervalues);
  Py_VISIT(traverse_module_state->__pyx_n_s_join);
  Py_VISIT(traverse_module_state->__pyx_n_s_k);
  Py_VISIT(traverse_module_state->__pyx_n_s_key);
  Py_VISIT(traverse_module_state->__pyx_n_s_keys);
  Py_VISIT(traverse_module_state->__pyx_n_s_kwargs);
  Py_VISIT(traverse_module_state->__pyx_n_s_length);
  Py_VISIT(traverse_module_state->__pyx_n_u_length);
  Py_VISIT(traverse_module_state->__pyx_kp_u_limits_violated);
  Py_VISIT(traverse_module_state->__pyx_n_s_line);
  Py_VISIT(traverse_module_state->__pyx_n_s_m);
  Py_VISIT(traverse_module_state->__pyx_n_s_main);
  Py_VISIT(traverse_module_state->__pyx_n_s_merge);
  Py_VISIT(traverse_module_state->__pyx_kp_u_missing_d_requested_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_mode);
  Py_VISIT(traverse_module_state->__pyx_kp_u_mode_contains_conflicting_format);
  Py_VISIT(traverse_module_state->__pyx_kp_u_mode_must_begin_with_r_w_or_a);
  Py_VISIT(traverse_module_state->__pyx_n_s_msg);
  Py_VISIT(traverse_module_state->__pyx_kp_u_must_set_at_least_2_alleles);
  Py_VISIT(traverse_module_state->__pyx_n_s_n);
  Py_VISIT(traverse_module_state->__pyx_n_s_name);
  Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_new);
  Py_VISIT(traverse_module_state->__pyx_n_s_new_record);
  Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
  Py_VISIT(traverse_module_state->__pyx_n_s_number);
  Py_VISIT(traverse_module_state->__pyx_n_s_object);
  Py_VISIT(traverse_module_state->__pyx_n_s_open);
  Py_VISIT(traverse_module_state->__pyx_n_s_os);
  Py_VISIT(traverse_module_state->__pyx_n_s_parse_region);
  Py_VISIT(traverse_module_state->__pyx_n_s_phased);
  Py_VISIT(traverse_module_state->__pyx_n_u_phased);
  Py_VISIT(traverse_module_state->__pyx_n_s_pickle);
  Py_VISIT(traverse_module_state->__pyx_n_s_pop);
  Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libcbcf);
  Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libcbcf_pyx);
  Py_VISIT(traverse_module_state->__pyx_n_s_pysam_utils);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_BaseIndex);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantContig);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderCont);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderMeta);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderReco);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantHeaderSamp);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantMetadata);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantRecordFilt);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantRecordForm);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantRecordInfo);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantRecordSamp);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_VariantRecordSamp_2);
  Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
  Py_VISIT(traverse_module_state->__pyx_n_s_qual);
  Py_VISIT(traverse_module_state->__pyx_n_s_quoted);
  Py_VISIT(traverse_module_state->__pyx_n_b_r);
  Py_VISIT(traverse_module_state->__pyx_n_s_r);
  Py_VISIT(traverse_module_state->__pyx_n_u_r);
  Py_VISIT(traverse_module_state->__pyx_n_s_range);
  Py_VISIT(traverse_module_state->__pyx_n_s_rec);
  Py_VISIT(traverse_module_state->__pyx_n_s_record);
  Py_VISIT(traverse_module_state->__pyx_kp_u_record_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_records);
  Py_VISIT(traverse_module_state->__pyx_n_s_reduce);
  Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex);
  Py_VISIT(traverse_module_state->__pyx_n_s_ref);
  Py_VISIT(traverse_module_state->__pyx_kp_u_ref_allele_must_not_be_null);
  Py_VISIT(traverse_module_state->__pyx_n_s_reference);
  Py_VISIT(traverse_module_state->__pyx_n_s_region);
  Py_VISIT(traverse_module_state->__pyx_n_s_remap);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove);
  Py_VISIT(traverse_module_state->__pyx_n_s_remove_header);
  Py_VISIT(traverse_module_state->__pyx_n_s_reopen);
  Py_VISIT(traverse_module_state->__pyx_n_s_reset);
  Py_VISIT(traverse_module_state->__pyx_n_s_ret);
  Py_VISIT(traverse_module_state->__pyx_n_s_reversed);
  Py_VISIT(traverse_module_state->__pyx_n_s_rid);
  Py_VISIT(traverse_module_state->__pyx_n_u_rwa);
  Py_VISIT(traverse_module_state->__pyx_n_s_sample);
  Py_VISIT(traverse_module_state->__pyx_kp_u_sample_must_not_be_None);
  Py_VISIT(traverse_module_state->__pyx_n_s_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_seek);
  Py_VISIT(traverse_module_state->__pyx_n_s_self);
  Py_VISIT(traverse_module_state->__pyx_kp_s_self_iter_cannot_be_converted_to);
  Py_VISIT(traverse_module_state->__pyx_kp_s_self_ptr_cannot_be_converted_to);
  Py_VISIT(traverse_module_state->__pyx_n_s_send);
  Py_VISIT(traverse_module_state->__pyx_n_s_setstate);
  Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython);
  Py_VISIT(traverse_module_state->__pyx_n_s_spec);
  Py_VISIT(traverse_module_state->__pyx_n_s_split);
  Py_VISIT(traverse_module_state->__pyx_n_s_src_hdr);
  Py_VISIT(traverse_module_state->__pyx_n_s_start);
  Py_VISIT(traverse_module_state->__pyx_n_s_startswith);
  Py_VISIT(traverse_module_state->__pyx_n_s_state);
  Py_VISIT(traverse_module_state->__pyx_n_s_stop);
  Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource);
  Py_VISIT(traverse_module_state->__pyx_n_s_strip);
  Py_VISIT(traverse_module_state->__pyx_n_s_subset_samples);
  Py_VISIT(traverse_module_state->__pyx_n_s_sys);
  Py_VISIT(traverse_module_state->__pyx_kp_u_tabix_index_required);
  Py_VISIT(traverse_module_state->__pyx_n_s_tell);
  Py_VISIT(traverse_module_state->__pyx_n_s_test);
  Py_VISIT(traverse_module_state->__pyx_kp_u_this_class_cannot_be_instantiate);
  Py_VISIT(traverse_module_state->__pyx_n_s_threads);
  Py_VISIT(traverse_module_state->__pyx_n_s_throw);
  Py_VISIT(traverse_module_state->__pyx_n_s_tid);
  Py_VISIT(traverse_module_state->__pyx_n_s_tidx);
  Py_VISIT(traverse_module_state->__pyx_n_s_translate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_truncated_file);
  Py_VISIT(traverse_module_state->__pyx_n_s_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unable_to_allocate_BCF_record);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unable_to_fetch);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unable_to_fetch_next_record);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unable_to_parse_next_record);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unable_to_reallocate_VariantHead);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_INFO);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_format);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_mode);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unknown_type_specified);
  Py_VISIT(traverse_module_state->__pyx_n_s_unquoted_str);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_header_type_code);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_info_type_code);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_type);
  Py_VISIT(traverse_module_state->__pyx_kp_u_unsupported_types);
  Py_VISIT(traverse_module_state->__pyx_n_s_update);
  Py_VISIT(traverse_module_state->__pyx_n_s_upper);
  Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate);
  Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8);
  Py_VISIT(traverse_module_state->__pyx_n_s_v);
  Py_VISIT(traverse_module_state->__pyx_n_s_value);
  Py_VISIT(traverse_module_state->__pyx_kp_u_value_expected_to_be_scalar_give);
  Py_VISIT(traverse_module_state->__pyx_n_s_values);
  Py_VISIT(traverse_module_state->__pyx_kp_u_values_expected_to_be_tuple_give);
  Py_VISIT(traverse_module_state->__pyx_n_s_vars);
  Py_VISIT(traverse_module_state->__pyx_kp_u_vcf_format_failed);
  Py_VISIT(traverse_module_state->__pyx_n_b_w);
  Py_VISIT(traverse_module_state->__pyx_n_u_w);
  Py_VISIT(traverse_module_state->__pyx_n_u_wb);
  Py_VISIT(traverse_module_state->__pyx_n_u_wb0);
  Py_VISIT(traverse_module_state->__pyx_n_u_wbu);
  Py_VISIT(traverse_module_state->__pyx_n_s_write);
  Py_VISIT(traverse_module_state->__pyx_n_u_wz);
  Py_VISIT(traverse_module_state->__pyx_int_0);
  Py_VISIT(traverse_module_state->__pyx_int_1);
  Py_VISIT(traverse_module_state->__pyx_int_2);
  Py_VISIT(traverse_module_state->__pyx_int_10091417);
  Py_VISIT(traverse_module_state->__pyx_int_10698032);
  Py_VISIT(traverse_module_state->__pyx_int_31479882);
  Py_VISIT(traverse_module_state->__pyx_int_33440904);
  Py_VISIT(traverse_module_state->__pyx_int_39264352);
  Py_VISIT(traverse_module_state->__pyx_int_41264896);
  Py_VISIT(traverse_module_state->__pyx_int_93650198);
  Py_VISIT(traverse_module_state->__pyx_int_94171383);
  Py_VISIT(traverse_module_state->__pyx_int_97976187);
  Py_VISIT(traverse_module_state->__pyx_int_118286449);
  Py_VISIT(traverse_module_state->__pyx_int_126454353);
  Py_VISIT(traverse_module_state->__pyx_int_135711299);
  Py_VISIT(traverse_module_state->__pyx_int_145625440);
  Py_VISIT(traverse_module_state->__pyx_int_164668780);
  Py_VISIT(traverse_module_state->__pyx_int_168021462);
  Py_VISIT(traverse_module_state->__pyx_int_199651019);
  Py_VISIT(traverse_module_state->__pyx_int_215036767);
  Py_VISIT(traverse_module_state->__pyx_int_227765731);
  Py_VISIT(traverse_module_state->__pyx_int_232881935);
  Py_VISIT(traverse_module_state->__pyx_int_248899179);
  Py_VISIT(traverse_module_state->__pyx_int_250317299);
  Py_VISIT(traverse_module_state->__pyx_int_4294967294);
  Py_VISIT(traverse_module_state->__pyx_int_neg_1);
  Py_VISIT(traverse_module_state->__pyx_k__41);
  Py_VISIT(traverse_module_state->__pyx_k__146);
  Py_VISIT(traverse_module_state->__pyx_k__158);
  Py_VISIT(traverse_module_state->__pyx_k__193);
  Py_VISIT(traverse_module_state->__pyx_k__206);
  Py_VISIT(traverse_module_state->__pyx_tuple_);
  Py_VISIT(traverse_module_state->__pyx_tuple__3);
  Py_VISIT(traverse_module_state->__pyx_tuple__4);
  Py_VISIT(traverse_module_state->__pyx_tuple__5);
  Py_VISIT(traverse_module_state->__pyx_tuple__6);
  Py_VISIT(traverse_module_state->__pyx_tuple__7);
  Py_VISIT(traverse_module_state->__pyx_tuple__8);
  Py_VISIT(traverse_module_state->__pyx_tuple__9);
  Py_VISIT(traverse_module_state->__pyx_tuple__10);
  Py_VISIT(traverse_module_state->__pyx_tuple__11);
  Py_VISIT(traverse_module_state->__pyx_tuple__13);
  Py_VISIT(traverse_module_state->__pyx_tuple__14);
  Py_VISIT(traverse_module_state->__pyx_tuple__15);
  Py_VISIT(traverse_module_state->__pyx_tuple__16);
  Py_VISIT(traverse_module_state->__pyx_tuple__17);
  Py_VISIT(traverse_module_state->__pyx_tuple__18);
  Py_VISIT(traverse_module_state->__pyx_tuple__19);
  Py_VISIT(traverse_module_state->__pyx_tuple__20);
  Py_VISIT(traverse_module_state->__pyx_tuple__21);
  Py_VISIT(traverse_module_state->__pyx_tuple__22);
  Py_VISIT(traverse_module_state->__pyx_tuple__23);
  Py_VISIT(traverse_module_state->__pyx_tuple__24);
  Py_VISIT(traverse_module_state->__pyx_tuple__25);
  Py_VISIT(traverse_module_state->__pyx_tuple__26);
  Py_VISIT(traverse_module_state->__pyx_tuple__27);
  Py_VISIT(traverse_module_state->__pyx_tuple__28);
  Py_VISIT(traverse_module_state->__pyx_tuple__29);
  Py_VISIT(traverse_module_state->__pyx_tuple__30);
  Py_VISIT(traverse_module_state->__pyx_tuple__31);
  Py_VISIT(traverse_module_state->__pyx_tuple__32);
  Py_VISIT(traverse_module_state->__pyx_tuple__43);
  Py_VISIT(traverse_module_state->__pyx_tuple__47);
  Py_VISIT(traverse_module_state->__pyx_tuple__48);
  Py_VISIT(traverse_module_state->__pyx_tuple__51);
  Py_VISIT(traverse_module_state->__pyx_tuple__57);
  Py_VISIT(traverse_module_state->__pyx_tuple__58);
  Py_VISIT(traverse_module_state->__pyx_tuple__60);
  Py_VISIT(traverse_module_state->__pyx_tuple__61);
  Py_VISIT(traverse_module_state->__pyx_tuple__76);
  Py_VISIT(traverse_module_state->__pyx_tuple__77);
  Py_VISIT(traverse_module_state->__pyx_tuple__88);
  Py_VISIT(traverse_module_state->__pyx_tuple__91);
  Py_VISIT(traverse_module_state->__pyx_tuple__95);
  Py_VISIT(traverse_module_state->__pyx_tuple__98);
  Py_VISIT(traverse_module_state->__pyx_slice__240);
  Py_VISIT(traverse_module_state->__pyx_tuple__100);
  Py_VISIT(traverse_module_state->__pyx_tuple__103);
  Py_VISIT(traverse_module_state->__pyx_tuple__105);
  Py_VISIT(traverse_module_state->__pyx_tuple__106);
  Py_VISIT(traverse_module_state->__pyx_tuple__111);
  Py_VISIT(traverse_module_state->__pyx_tuple__123);
  Py_VISIT(traverse_module_state->__pyx_tuple__124);
  Py_VISIT(traverse_module_state->__pyx_tuple__135);
  Py_VISIT(traverse_module_state->__pyx_tuple__136);
  Py_VISIT(traverse_module_state->__pyx_tuple__164);
  Py_VISIT(traverse_module_state->__pyx_tuple__165);
  Py_VISIT(traverse_module_state->__pyx_tuple__166);
  Py_VISIT(traverse_module_state->__pyx_tuple__167);
  Py_VISIT(traverse_module_state->__pyx_tuple__168);
  Py_VISIT(traverse_module_state->__pyx_tuple__169);
  Py_VISIT(traverse_module_state->__pyx_tuple__170);
  Py_VISIT(traverse_module_state->__pyx_tuple__171);
  Py_VISIT(traverse_module_state->__pyx_tuple__172);
  Py_VISIT(traverse_module_state->__pyx_tuple__173);
  Py_VISIT(traverse_module_state->__pyx_tuple__174);
  Py_VISIT(traverse_module_state->__pyx_tuple__175);
  Py_VISIT(traverse_module_state->__pyx_tuple__176);
  Py_VISIT(traverse_module_state->__pyx_tuple__177);
  Py_VISIT(traverse_module_state->__pyx_tuple__180);
  Py_VISIT(traverse_module_state->__pyx_tuple__182);
  Py_VISIT(traverse_module_state->__pyx_tuple__183);
  Py_VISIT(traverse_module_state->__pyx_tuple__197);
  Py_VISIT(traverse_module_state->__pyx_tuple__210);
  Py_VISIT(traverse_module_state->__pyx_tuple__219);
  Py_VISIT(traverse_module_state->__pyx_tuple__220);
  Py_VISIT(traverse_module_state->__pyx_tuple__221);
  Py_VISIT(traverse_module_state->__pyx_tuple__222);
  Py_VISIT(traverse_module_state->__pyx_tuple__223);
  Py_VISIT(traverse_module_state->__pyx_tuple__224);
  Py_VISIT(traverse_module_state->__pyx_tuple__227);
  Py_VISIT(traverse_module_state->__pyx_tuple__228);
  Py_VISIT(traverse_module_state->__pyx_tuple__232);
  Py_VISIT(traverse_module_state->__pyx_tuple__233);
  Py_VISIT(traverse_module_state->__pyx_tuple__234);
  Py_VISIT(traverse_module_state->__pyx_tuple__236);
  Py_VISIT(traverse_module_state->__pyx_tuple__238);
  Py_VISIT(traverse_module_state->__pyx_tuple__239);
  Py_VISIT(traverse_module_state->__pyx_tuple__242);
  Py_VISIT(traverse_module_state->__pyx_tuple__247);
  Py_VISIT(traverse_module_state->__pyx_tuple__249);
  Py_VISIT(traverse_module_state->__pyx_tuple__250);
  Py_VISIT(traverse_module_state->__pyx_tuple__253);
  Py_VISIT(traverse_module_state->__pyx_tuple__255);
  Py_VISIT(traverse_module_state->__pyx_tuple__256);
  Py_VISIT(traverse_module_state->__pyx_tuple__260);
  Py_VISIT(traverse_module_state->__pyx_tuple__262);
  Py_VISIT(traverse_module_state->__pyx_tuple__264);
  Py_VISIT(traverse_module_state->__pyx_tuple__266);
  Py_VISIT(traverse_module_state->__pyx_tuple__270);
  Py_VISIT(traverse_module_state->__pyx_tuple__275);
  Py_VISIT(traverse_module_state->__pyx_tuple__277);
  Py_VISIT(traverse_module_state->__pyx_tuple__279);
  Py_VISIT(traverse_module_state->__pyx_tuple__280);
  Py_VISIT(traverse_module_state->__pyx_tuple__281);
  Py_VISIT(traverse_module_state->__pyx_tuple__282);
  Py_VISIT(traverse_module_state->__pyx_tuple__283);
  Py_VISIT(traverse_module_state->__pyx_tuple__284);
  Py_VISIT(traverse_module_state->__pyx_tuple__285);
  Py_VISIT(traverse_module_state->__pyx_tuple__286);
  Py_VISIT(traverse_module_state->__pyx_tuple__287);
  Py_VISIT(traverse_module_state->__pyx_tuple__288);
  Py_VISIT(traverse_module_state->__pyx_tuple__289);
  Py_VISIT(traverse_module_state->__pyx_tuple__290);
  Py_VISIT(traverse_module_state->__pyx_tuple__291);
  Py_VISIT(traverse_module_state->__pyx_tuple__292);
  Py_VISIT(traverse_module_state->__pyx_tuple__293);
  Py_VISIT(traverse_module_state->__pyx_tuple__294);
  Py_VISIT(traverse_module_state->__pyx_tuple__295);
  Py_VISIT(traverse_module_state->__pyx_tuple__296);
  Py_VISIT(traverse_module_state->__pyx_tuple__297);
  Py_VISIT(traverse_module_state->__pyx_tuple__298);
  Py_VISIT(traverse_module_state->__pyx_tuple__299);
  Py_VISIT(traverse_module_state->__pyx_tuple__300);
  Py_VISIT(traverse_module_state->__pyx_tuple__301);
  Py_VISIT(traverse_module_state->__pyx_tuple__302);
  Py_VISIT(traverse_module_state->__pyx_tuple__303);
  Py_VISIT(traverse_module_state->__pyx_tuple__304);
  Py_VISIT(traverse_module_state->__pyx_tuple__305);
  Py_VISIT(traverse_module_state->__pyx_tuple__306);
  Py_VISIT(traverse_module_state->__pyx_tuple__307);
  Py_VISIT(traverse_module_state->__pyx_tuple__308);
  Py_VISIT(traverse_module_state->__pyx_tuple__309);
  Py_VISIT(traverse_module_state->__pyx_tuple__310);
  Py_VISIT(traverse_module_state->__pyx_tuple__311);
  Py_VISIT(traverse_module_state->__pyx_tuple__312);
  Py_VISIT(traverse_module_state->__pyx_tuple__313);
  Py_VISIT(traverse_module_state->__pyx_tuple__314);
  Py_VISIT(traverse_module_state->__pyx_tuple__315);
  Py_VISIT(traverse_module_state->__pyx_tuple__316);
  Py_VISIT(traverse_module_state->__pyx_tuple__317);
  Py_VISIT(traverse_module_state->__pyx_tuple__318);
  Py_VISIT(traverse_module_state->__pyx_tuple__319);
  Py_VISIT(traverse_module_state->__pyx_tuple__320);
  Py_VISIT(traverse_module_state->__pyx_tuple__321);
  Py_VISIT(traverse_module_state->__pyx_tuple__322);
  Py_VISIT(traverse_module_state->__pyx_tuple__324);
  Py_VISIT(traverse_module_state->__pyx_tuple__325);
  Py_VISIT(traverse_module_state->__pyx_tuple__326);
  Py_VISIT(traverse_module_state->__pyx_tuple__327);
  Py_VISIT(traverse_module_state->__pyx_tuple__328);
  Py_VISIT(traverse_module_state->__pyx_tuple__329);
  Py_VISIT(traverse_module_state->__pyx_codeobj__33);
  Py_VISIT(traverse_module_state->__pyx_codeobj__34);
  Py_VISIT(traverse_module_state->__pyx_codeobj__35);
  Py_VISIT(traverse_module_state->__pyx_codeobj__36);
  Py_VISIT(traverse_module_state->__pyx_codeobj__37);
  Py_VISIT(traverse_module_state->__pyx_codeobj__38);
  Py_VISIT(traverse_module_state->__pyx_codeobj__39);
  Py_VISIT(traverse_module_state->__pyx_codeobj__40);
  Py_VISIT(traverse_module_state->__pyx_codeobj__42);
  Py_VISIT(traverse_module_state->__pyx_codeobj__44);
  Py_VISIT(traverse_module_state->__pyx_codeobj__45);
  Py_VISIT(traverse_module_state->__pyx_codeobj__46);
  Py_VISIT(traverse_module_state->__pyx_codeobj__49);
  Py_VISIT(traverse_module_state->__pyx_codeobj__50);
  Py_VISIT(traverse_module_state->__pyx_codeobj__54);
  Py_VISIT(traverse_module_state->__pyx_codeobj__55);
  Py_VISIT(traverse_module_state->__pyx_codeobj__56);
  Py_VISIT(traverse_module_state->__pyx_codeobj__59);
  Py_VISIT(traverse_module_state->__pyx_codeobj__62);
  Py_VISIT(traverse_module_state->__pyx_codeobj__63);
  Py_VISIT(traverse_module_state->__pyx_codeobj__64);
  Py_VISIT(traverse_module_state->__pyx_codeobj__65);
  Py_VISIT(traverse_module_state->__pyx_codeobj__66);
  Py_VISIT(traverse_module_state->__pyx_codeobj__67);
  Py_VISIT(traverse_module_state->__pyx_codeobj__68);
  Py_VISIT(traverse_module_state->__pyx_codeobj__69);
  Py_VISIT(traverse_module_state->__pyx_codeobj__70);
  Py_VISIT(traverse_module_state->__pyx_codeobj__71);
  Py_VISIT(traverse_module_state->__pyx_codeobj__72);
  Py_VISIT(traverse_module_state->__pyx_codeobj__73);
  Py_VISIT(traverse_module_state->__pyx_codeobj__74);
  Py_VISIT(traverse_module_state->__pyx_codeobj__75);
  Py_VISIT(traverse_module_state->__pyx_codeobj__78);
  Py_VISIT(traverse_module_state->__pyx_codeobj__79);
  Py_VISIT(traverse_module_state->__pyx_codeobj__80);
  Py_VISIT(traverse_module_state->__pyx_codeobj__81);
  Py_VISIT(traverse_module_state->__pyx_codeobj__82);
  Py_VISIT(traverse_module_state->__pyx_codeobj__83);
  Py_VISIT(traverse_module_state->__pyx_codeobj__84);
  Py_VISIT(traverse_module_state->__pyx_codeobj__85);
  Py_VISIT(traverse_module_state->__pyx_codeobj__86);
  Py_VISIT(traverse_module_state->__pyx_codeobj__87);
  Py_VISIT(traverse_module_state->__pyx_codeobj__89);
  Py_VISIT(traverse_module_state->__pyx_codeobj__90);
  Py_VISIT(traverse_module_state->__pyx_codeobj__92);
  Py_VISIT(traverse_module_state->__pyx_codeobj__93);
  Py_VISIT(traverse_module_state->__pyx_codeobj__94);
  Py_VISIT(traverse_module_state->__pyx_codeobj__96);
  Py_VISIT(traverse_module_state->__pyx_codeobj__97);
  Py_VISIT(traverse_module_state->__pyx_codeobj__99);
  Py_VISIT(traverse_module_state->__pyx_codeobj__101);
  Py_VISIT(traverse_module_state->__pyx_codeobj__102);
  Py_VISIT(traverse_module_state->__pyx_codeobj__104);
  Py_VISIT(traverse_module_state->__pyx_codeobj__107);
  Py_VISIT(traverse_module_state->__pyx_codeobj__108);
  Py_VISIT(traverse_module_state->__pyx_codeobj__109);
  Py_VISIT(traverse_module_state->__pyx_codeobj__110);
  Py_VISIT(traverse_module_state->__pyx_codeobj__112);
  Py_VISIT(traverse_module_state->__pyx_codeobj__113);
  Py_VISIT(traverse_module_state->__pyx_codeobj__114);
  Py_VISIT(traverse_module_state->__pyx_codeobj__115);
  Py_VISIT(traverse_module_state->__pyx_codeobj__116);
  Py_VISIT(traverse_module_state->__pyx_codeobj__117);
  Py_VISIT(traverse_module_state->__pyx_codeobj__118);
  Py_VISIT(traverse_module_state->__pyx_codeobj__119);
  Py_VISIT(traverse_module_state->__pyx_codeobj__120);
  Py_VISIT(traverse_module_state->__pyx_codeobj__121);
  Py_VISIT(traverse_module_state->__pyx_codeobj__122);
  Py_VISIT(traverse_module_state->__pyx_codeobj__125);
  Py_VISIT(traverse_module_state->__pyx_codeobj__126);
  Py_VISIT(traverse_module_state->__pyx_codeobj__127);
  Py_VISIT(traverse_module_state->__pyx_codeobj__128);
  Py_VISIT(traverse_module_state->__pyx_codeobj__129);
  Py_VISIT(traverse_module_state->__pyx_codeobj__130);
  Py_VISIT(traverse_module_state->__pyx_codeobj__131);
  Py_VISIT(traverse_module_state->__pyx_codeobj__132);
  Py_VISIT(traverse_module_state->__pyx_codeobj__133);
  Py_VISIT(traverse_module_state->__pyx_codeobj__134);
  Py_VISIT(traverse_module_state->__pyx_codeobj__137);
  Py_VISIT(traverse_module_state->__pyx_codeobj__138);
  Py_VISIT(traverse_module_state->__pyx_codeobj__139);
  Py_VISIT(traverse_module_state->__pyx_codeobj__140);
  Py_VISIT(traverse_module_state->__pyx_codeobj__141);
  Py_VISIT(traverse_module_state->__pyx_codeobj__142);
  Py_VISIT(traverse_module_state->__pyx_codeobj__143);
  Py_VISIT(traverse_module_state->__pyx_codeobj__144);
  Py_VISIT(traverse_module_state->__pyx_codeobj__145);
  Py_VISIT(traverse_module_state->__pyx_codeobj__147);
  Py_VISIT(traverse_module_state->__pyx_codeobj__148);
  Py_VISIT(traverse_module_state->__pyx_codeobj__149);
  Py_VISIT(traverse_module_state->__pyx_codeobj__150);
  Py_VISIT(traverse_module_state->__pyx_codeobj__151);
  Py_VISIT(traverse_module_state->__pyx_codeobj__152);
  Py_VISIT(traverse_module_state->__pyx_codeobj__153);
  Py_VISIT(traverse_module_state->__pyx_codeobj__154);
  Py_VISIT(traverse_module_state->__pyx_codeobj__155);
  Py_VISIT(traverse_module_state->__pyx_codeobj__156);
  Py_VISIT(traverse_module_state->__pyx_codeobj__157);
  Py_VISIT(traverse_module_state->__pyx_codeobj__159);
  Py_VISIT(traverse_module_state->__pyx_codeobj__160);
  Py_VISIT(traverse_module_state->__pyx_codeobj__161);
  Py_VISIT(traverse_module_state->__pyx_codeobj__162);
  Py_VISIT(traverse_module_state->__pyx_codeobj__163);
  Py_VISIT(traverse_module_state->__pyx_codeobj__178);
  Py_VISIT(traverse_module_state->__pyx_codeobj__179);
  Py_VISIT(traverse_module_state->__pyx_codeobj__184);
  Py_VISIT(traverse_module_state->__pyx_codeobj__185);
  Py_VISIT(traverse_module_state->__pyx_codeobj__186);
  Py_VISIT(traverse_module_state->__pyx_codeobj__187);
  Py_VISIT(traverse_module_state->__pyx_codeobj__188);
  Py_VISIT(traverse_module_state->__pyx_codeobj__189);
  Py_VISIT(traverse_module_state->__pyx_codeobj__190);
  Py_VISIT(traverse_module_state->__pyx_codeobj__191);
  Py_VISIT(traverse_module_state->__pyx_codeobj__192);
  Py_VISIT(traverse_module_state->__pyx_codeobj__194);
  Py_VISIT(traverse_module_state->__pyx_codeobj__195);
  Py_VISIT(traverse_module_state->__pyx_codeobj__196);
  Py_VISIT(traverse_module_state->__pyx_codeobj__198);
  Py_VISIT(traverse_module_state->__pyx_codeobj__199);
  Py_VISIT(traverse_module_state->__pyx_codeobj__200);
  Py_VISIT(traverse_module_state->__pyx_codeobj__201);
  Py_VISIT(traverse_module_state->__pyx_codeobj__202);
  Py_VISIT(traverse_module_state->__pyx_codeobj__203);
  Py_VISIT(traverse_module_state->__pyx_codeobj__204);
  Py_VISIT(traverse_module_state->__pyx_codeobj__205);
  Py_VISIT(traverse_module_state->__pyx_codeobj__207);
  Py_VISIT(traverse_module_state->__pyx_codeobj__208);
  Py_VISIT(traverse_module_state->__pyx_codeobj__209);
  Py_VISIT(traverse_module_state->__pyx_codeobj__211);
  Py_VISIT(traverse_module_state->__pyx_codeobj__212);
  Py_VISIT(traverse_module_state->__pyx_codeobj__213);
  Py_VISIT(traverse_module_state->__pyx_codeobj__214);
  Py_VISIT(traverse_module_state->__pyx_codeobj__215);
  Py_VISIT(traverse_module_state->__pyx_codeobj__216);
  Py_VISIT(traverse_module_state->__pyx_codeobj__217);
  Py_VISIT(traverse_module_state->__pyx_codeobj__218);
  Py_VISIT(traverse_module_state->__pyx_codeobj__225);
  Py_VISIT(traverse_module_state->__pyx_codeobj__226);
  Py_VISIT(traverse_module_state->__pyx_codeobj__229);
  Py_VISIT(traverse_module_state->__pyx_codeobj__230);
  Py_VISIT(traverse_module_state->__pyx_codeobj__231);
  Py_VISIT(traverse_module_state->__pyx_codeobj__235);
  Py_VISIT(traverse_module_state->__pyx_codeobj__237);
  Py_VISIT(traverse_module_state->__pyx_codeobj__243);
  Py_VISIT(traverse_module_state->__pyx_codeobj__244);
  Py_VISIT(traverse_module_state->__pyx_codeobj__245);
  Py_VISIT(traverse_module_state->__pyx_codeobj__246);
  Py_VISIT(traverse_module_state->__pyx_codeobj__248);
  Py_VISIT(traverse_module_state->__pyx_codeobj__251);
  Py_VISIT(traverse_module_state->__pyx_codeobj__252);
  Py_VISIT(traverse_module_state->__pyx_codeobj__254);
  Py_VISIT(traverse_module_state->__pyx_codeobj__257);
  Py_VISIT(traverse_module_state->__pyx_codeobj__258);
  Py_VISIT(traverse_module_state->__pyx_codeobj__259);
  Py_VISIT(traverse_module_state->__pyx_codeobj__261);
  Py_VISIT(traverse_module_state->__pyx_codeobj__263);
  Py_VISIT(traverse_module_state->__pyx_codeobj__265);
  Py_VISIT(traverse_module_state->__pyx_codeobj__267);
  Py_VISIT(traverse_module_state->__pyx_codeobj__268);
  Py_VISIT(traverse_module_state->__pyx_codeobj__269);
  Py_VISIT(traverse_module_state->__pyx_codeobj__271);
  Py_VISIT(traverse_module_state->__pyx_codeobj__272);
  Py_VISIT(traverse_module_state->__pyx_codeobj__273);
  Py_VISIT(traverse_module_state->__pyx_codeobj__274);
  Py_VISIT(traverse_module_state->__pyx_codeobj__276);
  return 0;
}
#endif
/* #### Code section: module_state_defines ### */
#define __pyx_d __pyx_mstate_global->__pyx_d
#define __pyx_b __pyx_mstate_global->__pyx_b
#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
#ifdef __Pyx_CyFunction_USED
#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
#endif
#ifdef __Pyx_FusedFunction_USED
#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
#endif
#ifdef __Pyx_Generator_USED
#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
#endif
#ifdef __Pyx_IterableCoroutine_USED
#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
#endif
#ifdef __Pyx_Coroutine_USED
#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
#endif
#ifdef __Pyx_Coroutine_USED
#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_5pysam_10libchtslib_HTSFile __pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#endif
#define __pyx_ptype_7cpython_5array_array __pyx_mstate_global->__pyx_ptype_7cpython_5array_array
#if CYTHON_USE_MODULE_STATE
#endif
#if CYTHON_USE_MODULE_STATE
#define __pyx_type_5pysam_7libcbcf_VariantHeader __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeader
#define __pyx_type_5pysam_7libcbcf_VariantHeaderRecord __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeaderRecord
#define __pyx_type_5pysam_7libcbcf_VariantHeaderRecords __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeaderRecords
#define __pyx_type_5pysam_7libcbcf_VariantHeaderContigs __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeaderContigs
#define __pyx_type_5pysam_7libcbcf_VariantHeaderSamples __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeaderSamples
#define __pyx_type_5pysam_7libcbcf_VariantContig __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantContig
#define __pyx_type_5pysam_7libcbcf_VariantMetadata __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantMetadata
#define __pyx_type_5pysam_7libcbcf_VariantHeaderMetadata __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata
#define __pyx_type_5pysam_7libcbcf_VariantRecord __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecord
#define __pyx_type_5pysam_7libcbcf_VariantRecordFilter __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecordFilter
#define __pyx_type_5pysam_7libcbcf_VariantRecordFormat __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecordFormat
#define __pyx_type_5pysam_7libcbcf_VariantRecordInfo __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecordInfo
#define __pyx_type_5pysam_7libcbcf_VariantRecordSamples __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecordSamples
#define __pyx_type_5pysam_7libcbcf_VariantRecordSample __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantRecordSample
#define __pyx_type_5pysam_7libcbcf_BaseIndex __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_BaseIndex
#define __pyx_type_5pysam_7libcbcf_BCFIndex __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_BCFIndex
#define __pyx_type_5pysam_7libcbcf_TabixIndex __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_TabixIndex
#define __pyx_type_5pysam_7libcbcf_BaseIterator __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_BaseIterator
#define __pyx_type_5pysam_7libcbcf_BCFIterator __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_BCFIterator
#define __pyx_type_5pysam_7libcbcf_TabixIterator __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_TabixIterator
#define __pyx_type_5pysam_7libcbcf_VariantFile __pyx_mstate_global->__pyx_type_5pysam_7libcbcf_VariantFile
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__ __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues
#define __pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems __pyx_mstate_global->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems
#endif
#define __pyx_ptype_5pysam_7libcbcf_VariantHeader __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader
#define __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord
#define __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords
#define __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs
#define __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples
#define __pyx_ptype_5pysam_7libcbcf_VariantContig __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig
#define __pyx_ptype_5pysam_7libcbcf_VariantMetadata __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata
#define __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata
#define __pyx_ptype_5pysam_7libcbcf_VariantRecord __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord
#define __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter
#define __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat
#define __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo
#define __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples
#define __pyx_ptype_5pysam_7libcbcf_VariantRecordSample __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample
#define __pyx_ptype_5pysam_7libcbcf_BaseIndex __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex
#define __pyx_ptype_5pysam_7libcbcf_BCFIndex __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex
#define __pyx_ptype_5pysam_7libcbcf_TabixIndex __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex
#define __pyx_ptype_5pysam_7libcbcf_BaseIterator __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIterator
#define __pyx_ptype_5pysam_7libcbcf_BCFIterator __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIterator
#define __pyx_ptype_5pysam_7libcbcf_TabixIterator __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIterator
#define __pyx_ptype_5pysam_7libcbcf_VariantFile __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile
#define __pyx_ptype_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
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__ __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues
#define __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems
#define __pyx_n_u_A __pyx_mstate_global->__pyx_n_u_A
#define __pyx_n_u_ALT __pyx_mstate_global->__pyx_n_u_ALT
#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError
#define __pyx_n_s_BCFIndex __pyx_mstate_global->__pyx_n_s_BCFIndex
#define __pyx_n_u_BCFIndex __pyx_mstate_global->__pyx_n_u_BCFIndex
#define __pyx_n_s_BCFIndex___reduce_cython __pyx_mstate_global->__pyx_n_s_BCFIndex___reduce_cython
#define __pyx_n_s_BCFIndex___setstate_cython __pyx_mstate_global->__pyx_n_s_BCFIndex___setstate_cython
#define __pyx_n_s_BCFIndex_fetch __pyx_mstate_global->__pyx_n_s_BCFIndex_fetch
#define __pyx_n_s_BCFIterator __pyx_mstate_global->__pyx_n_s_BCFIterator
#define __pyx_n_u_BCFIterator __pyx_mstate_global->__pyx_n_u_BCFIterator
#define __pyx_n_s_BCFIterator___reduce_cython __pyx_mstate_global->__pyx_n_s_BCFIterator___reduce_cython
#define __pyx_n_s_BCFIterator___setstate_cython __pyx_mstate_global->__pyx_n_s_BCFIterator___setstate_cython
#define __pyx_n_u_BND __pyx_mstate_global->__pyx_n_u_BND
#define __pyx_n_s_BaseIndex __pyx_mstate_global->__pyx_n_s_BaseIndex
#define __pyx_n_u_BaseIndex __pyx_mstate_global->__pyx_n_u_BaseIndex
#define __pyx_n_s_BaseIndex___reduce_cython __pyx_mstate_global->__pyx_n_s_BaseIndex___reduce_cython
#define __pyx_n_s_BaseIndex___setstate_cython __pyx_mstate_global->__pyx_n_s_BaseIndex___setstate_cython
#define __pyx_n_s_BaseIndex_get __pyx_mstate_global->__pyx_n_s_BaseIndex_get
#define __pyx_n_s_BaseIndex_items __pyx_mstate_global->__pyx_n_s_BaseIndex_items
#define __pyx_n_s_BaseIndex_iteritems __pyx_mstate_global->__pyx_n_s_BaseIndex_iteritems
#define __pyx_n_s_BaseIndex_iterkeys __pyx_mstate_global->__pyx_n_s_BaseIndex_iterkeys
#define __pyx_n_s_BaseIndex_itervalues __pyx_mstate_global->__pyx_n_s_BaseIndex_itervalues
#define __pyx_n_s_BaseIndex_keys __pyx_mstate_global->__pyx_n_s_BaseIndex_keys
#define __pyx_n_s_BaseIndex_pop __pyx_mstate_global->__pyx_n_s_BaseIndex_pop
#define __pyx_n_s_BaseIndex_update __pyx_mstate_global->__pyx_n_s_BaseIndex_update
#define __pyx_n_s_BaseIndex_values __pyx_mstate_global->__pyx_n_s_BaseIndex_values
#define __pyx_n_s_BaseIterator __pyx_mstate_global->__pyx_n_s_BaseIterator
#define __pyx_n_u_BaseIterator __pyx_mstate_global->__pyx_n_u_BaseIterator
#define __pyx_n_s_BaseIterator___reduce_cython __pyx_mstate_global->__pyx_n_s_BaseIterator___reduce_cython
#define __pyx_n_s_BaseIterator___setstate_cython __pyx_mstate_global->__pyx_n_s_BaseIterator___setstate_cython
#define __pyx_n_u_CONTIG __pyx_mstate_global->__pyx_n_u_CONTIG
#define __pyx_kp_u_Cannot_add_extra_threads_when_ig __pyx_mstate_global->__pyx_kp_u_Cannot_add_extra_threads_when_ig
#define __pyx_kp_u_Cannot_copy_arrays_with_src_valu __pyx_mstate_global->__pyx_kp_u_Cannot_copy_arrays_with_src_valu
#define __pyx_kp_u_Cannot_create_empty_array __pyx_mstate_global->__pyx_kp_u_Cannot_create_empty_array
#define __pyx_kp_u_Cannot_re_open_htsfile __pyx_mstate_global->__pyx_kp_u_Cannot_re_open_htsfile
#define __pyx_kp_u_Cannot_set_phased_before_genotyp __pyx_mstate_global->__pyx_kp_u_Cannot_set_phased_before_genotyp
#define __pyx_kp_u_Cannot_specify_an_index_filename __pyx_mstate_global->__pyx_kp_u_Cannot_specify_an_index_filename
#define __pyx_kp_u_Cannot_translate_record_Number_o __pyx_mstate_global->__pyx_kp_u_Cannot_translate_record_Number_o
#define __pyx_n_u_Description __pyx_mstate_global->__pyx_n_u_Description
#define __pyx_kp_u_Duplicated_sample_name __pyx_mstate_global->__pyx_kp_u_Duplicated_sample_name
#define __pyx_n_b_END __pyx_mstate_global->__pyx_n_b_END
#define __pyx_n_u_END __pyx_mstate_global->__pyx_n_u_END
#define __pyx_kp_u_END_is_a_reserved_attribute_acce __pyx_mstate_global->__pyx_kp_u_END_is_a_reserved_attribute_acce
#define __pyx_kp_u_Error_extracting_ID __pyx_mstate_global->__pyx_kp_u_Error_extracting_ID
#define __pyx_kp_u_Error_s_reading_record __pyx_mstate_global->__pyx_kp_u_Error_s_reading_record
#define __pyx_kp_u_Error_unpacking_VariantRecord __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord
#define __pyx_kp_u_Error_updating_alleles __pyx_mstate_global->__pyx_kp_u_Error_updating_alleles
#define __pyx_kp_u_Error_updating_id __pyx_mstate_global->__pyx_kp_u_Error_updating_id
#define __pyx_n_u_FILTER __pyx_mstate_global->__pyx_n_u_FILTER
#define __pyx_n_u_FIXED __pyx_mstate_global->__pyx_n_u_FIXED
#define __pyx_n_u_FORMAT __pyx_mstate_global->__pyx_n_u_FORMAT
#define __pyx_n_u_Flag __pyx_mstate_global->__pyx_n_u_Flag
#define __pyx_kp_u_Flag_types_are_not_allowed_on_FO __pyx_mstate_global->__pyx_kp_u_Flag_types_are_not_allowed_on_FO
#define __pyx_kp_u_Flag_values_must_be_True_False_N __pyx_mstate_global->__pyx_kp_u_Flag_values_must_be_True_False_N
#define __pyx_n_u_Float __pyx_mstate_global->__pyx_n_u_Float
#define __pyx_n_u_G __pyx_mstate_global->__pyx_n_u_G
#define __pyx_n_u_GENERIC __pyx_mstate_global->__pyx_n_u_GENERIC
#define __pyx_n_u_GT __pyx_mstate_global->__pyx_n_u_GT
#define __pyx_kp_u_Header_already_exists_for_contig __pyx_mstate_global->__pyx_kp_u_Header_already_exists_for_contig
#define __pyx_kp_u_Header_already_exists_for_id __pyx_mstate_global->__pyx_kp_u_Header_already_exists_for_id
#define __pyx_n_u_ID __pyx_mstate_global->__pyx_n_u_ID
#define __pyx_n_u_INDEL __pyx_mstate_global->__pyx_n_u_INDEL
#define __pyx_n_u_INFO __pyx_mstate_global->__pyx_n_u_INFO
#define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
#define __pyx_kp_u_I_O_operation_on_closed_file __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6
#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7
#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError
#define __pyx_n_u_Integer __pyx_mstate_global->__pyx_n_u_Integer
#define __pyx_kp_u_Integer_value_too_small_large_to __pyx_mstate_global->__pyx_kp_u_Integer_value_too_small_large_to
#define __pyx_kp_u_Invalid_INFO_field __pyx_mstate_global->__pyx_kp_u_Invalid_INFO_field
#define __pyx_kp_u_Invalid_VariantRecord_Number_of __pyx_mstate_global->__pyx_kp_u_Invalid_VariantRecord_Number_of
#define __pyx_kp_u_Invalid_allele_index __pyx_mstate_global->__pyx_kp_u_Invalid_allele_index
#define __pyx_kp_u_Invalid_chromosome_contig __pyx_mstate_global->__pyx_kp_u_Invalid_chromosome_contig
#define __pyx_kp_u_Invalid_filter __pyx_mstate_global->__pyx_kp_u_Invalid_filter
#define __pyx_kp_u_Invalid_header __pyx_mstate_global->__pyx_kp_u_Invalid_header
#define __pyx_kp_u_Invalid_header_id __pyx_mstate_global->__pyx_kp_u_Invalid_header_id
#define __pyx_kp_u_Invalid_header_record_index __pyx_mstate_global->__pyx_kp_u_Invalid_header_record_index
#define __pyx_kp_u_Invalid_index_object __pyx_mstate_global->__pyx_kp_u_Invalid_index_object
#define __pyx_kp_u_Invalid_tid __pyx_mstate_global->__pyx_kp_u_Invalid_tid
#define __pyx_n_s_KeyError __pyx_mstate_global->__pyx_n_s_KeyError
#define __pyx_n_u_MNP __pyx_mstate_global->__pyx_n_u_MNP
#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
#define __pyx_kp_u_NON_REF __pyx_mstate_global->__pyx_kp_u_NON_REF
#define __pyx_n_s_NotImplemented __pyx_mstate_global->__pyx_n_s_NotImplemented
#define __pyx_n_u_Number __pyx_mstate_global->__pyx_n_u_Number
#define __pyx_kp_u_Number_must_be_None_when_adding __pyx_mstate_global->__pyx_kp_u_Number_must_be_None_when_adding
#define __pyx_n_u_OTHER __pyx_mstate_global->__pyx_n_u_OTHER
#define __pyx_n_u_OVERLAP __pyx_mstate_global->__pyx_n_u_OVERLAP
#define __pyx_kp_u_One_or_more_of_the_supplied_samp __pyx_mstate_global->__pyx_kp_u_One_or_more_of_the_supplied_samp
#define __pyx_n_u_PASS __pyx_mstate_global->__pyx_n_u_PASS
#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError
#define __pyx_kp_u_Position_must_be_positive __pyx_mstate_global->__pyx_kp_u_Position_must_be_positive
#define __pyx_n_u_R __pyx_mstate_global->__pyx_n_u_R
#define __pyx_n_u_REF __pyx_mstate_global->__pyx_n_u_REF
#define __pyx_n_u_SNP __pyx_mstate_global->__pyx_n_u_SNP
#define __pyx_n_u_STRUCTURED __pyx_mstate_global->__pyx_n_u_STRUCTURED
#define __pyx_kp_u_Start_coordinate_must_be_non_neg __pyx_mstate_global->__pyx_kp_u_Start_coordinate_must_be_non_neg
#define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration
#define __pyx_kp_u_Stop_coordinate_must_be_non_nega __pyx_mstate_global->__pyx_kp_u_Stop_coordinate_must_be_non_nega
#define __pyx_kp_u_Stop_position_of_the_interval __pyx_mstate_global->__pyx_kp_u_Stop_position_of_the_interval
#define __pyx_n_u_String __pyx_mstate_global->__pyx_n_u_String
#define __pyx_n_s_TabixIndex __pyx_mstate_global->__pyx_n_s_TabixIndex
#define __pyx_n_u_TabixIndex __pyx_mstate_global->__pyx_n_u_TabixIndex
#define __pyx_n_s_TabixIndex___reduce_cython __pyx_mstate_global->__pyx_n_s_TabixIndex___reduce_cython
#define __pyx_n_s_TabixIndex___setstate_cython __pyx_mstate_global->__pyx_n_s_TabixIndex___setstate_cython
#define __pyx_n_s_TabixIndex_fetch __pyx_mstate_global->__pyx_n_s_TabixIndex_fetch
#define __pyx_n_s_TabixIterator __pyx_mstate_global->__pyx_n_s_TabixIterator
#define __pyx_n_u_TabixIterator __pyx_mstate_global->__pyx_n_u_TabixIterator
#define __pyx_n_s_TabixIterator___reduce_cython __pyx_mstate_global->__pyx_n_s_TabixIterator___reduce_cython
#define __pyx_n_s_TabixIterator___setstate_cython __pyx_mstate_global->__pyx_n_s_TabixIterator___setstate_cython
#define __pyx_n_u_Type __pyx_mstate_global->__pyx_n_u_Type
#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
#define __pyx_kp_u_Type_must_be_None_when_adding_a __pyx_mstate_global->__pyx_kp_u_Type_must_be_None_when_adding_a
#define __pyx_kp_u_Unable_to_delete_END __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_END
#define __pyx_kp_u_Unable_to_delete_FORMAT __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_FORMAT
#define __pyx_kp_u_Unable_to_delete_INFO __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_INFO
#define __pyx_kp_u_Unable_to_update_INFO_values __pyx_mstate_global->__pyx_kp_u_Unable_to_update_INFO_values
#define __pyx_kp_u_Unable_to_update_format_values __pyx_mstate_global->__pyx_kp_u_Unable_to_update_format_values
#define __pyx_kp_u_Unknown_INFO_field __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field
#define __pyx_kp_u_Unknown_allele __pyx_mstate_global->__pyx_kp_u_Unknown_allele
#define __pyx_kp_u_Unknown_format_length __pyx_mstate_global->__pyx_kp_u_Unknown_format_length
#define __pyx_kp_u_Unsupported_FORMAT_type __pyx_mstate_global->__pyx_kp_u_Unsupported_FORMAT_type
#define __pyx_kp_u_Unsupported_INFO_type __pyx_mstate_global->__pyx_kp_u_Unsupported_INFO_type
#define __pyx_kp_u_Use_allele_indices_to_set_intege __pyx_mstate_global->__pyx_kp_u_Use_allele_indices_to_set_intege
#define __pyx_n_u_VARIABLE __pyx_mstate_global->__pyx_n_u_VARIABLE
#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
#define __pyx_n_s_VariantContig __pyx_mstate_global->__pyx_n_s_VariantContig
#define __pyx_n_u_VariantContig __pyx_mstate_global->__pyx_n_u_VariantContig
#define __pyx_n_s_VariantContig___reduce_cython __pyx_mstate_global->__pyx_n_s_VariantContig___reduce_cython
#define __pyx_n_s_VariantContig___setstate_cython __pyx_mstate_global->__pyx_n_s_VariantContig___setstate_cython
#define __pyx_n_s_VariantContig_remove_header __pyx_mstate_global->__pyx_n_s_VariantContig_remove_header
#define __pyx_n_s_VariantFile __pyx_mstate_global->__pyx_n_s_VariantFile
#define __pyx_n_u_VariantFile __pyx_mstate_global->__pyx_n_u_VariantFile
#define __pyx_n_s_VariantFile___reduce_cython __pyx_mstate_global->__pyx_n_s_VariantFile___reduce_cython
#define __pyx_n_s_VariantFile___setstate_cython __pyx_mstate_global->__pyx_n_s_VariantFile___setstate_cython
#define __pyx_n_s_VariantFile_close __pyx_mstate_global->__pyx_n_s_VariantFile_close
#define __pyx_n_s_VariantFile_copy __pyx_mstate_global->__pyx_n_s_VariantFile_copy
#define __pyx_n_s_VariantFile_fetch __pyx_mstate_global->__pyx_n_s_VariantFile_fetch
#define __pyx_n_s_VariantFile_get_reference_name __pyx_mstate_global->__pyx_n_s_VariantFile_get_reference_name
#define __pyx_n_s_VariantFile_get_tid __pyx_mstate_global->__pyx_n_s_VariantFile_get_tid
#define __pyx_n_s_VariantFile_is_valid_tid __pyx_mstate_global->__pyx_n_s_VariantFile_is_valid_tid
#define __pyx_n_s_VariantFile_new_record __pyx_mstate_global->__pyx_n_s_VariantFile_new_record
#define __pyx_n_s_VariantFile_open __pyx_mstate_global->__pyx_n_s_VariantFile_open
#define __pyx_n_s_VariantFile_reset __pyx_mstate_global->__pyx_n_s_VariantFile_reset
#define __pyx_n_s_VariantFile_subset_samples __pyx_mstate_global->__pyx_n_s_VariantFile_subset_samples
#define __pyx_n_s_VariantFile_write __pyx_mstate_global->__pyx_n_s_VariantFile_write
#define __pyx_n_s_VariantHeader __pyx_mstate_global->__pyx_n_s_VariantHeader
#define __pyx_n_u_VariantHeader __pyx_mstate_global->__pyx_n_u_VariantHeader
#define __pyx_n_s_VariantHeaderContigs __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs
#define __pyx_n_u_VariantHeaderContigs __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs
#define __pyx_n_s_VariantHeaderContigs___iter __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs___iter
#define __pyx_n_s_VariantHeaderContigs___reduce_cy __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs___reduce_cy
#define __pyx_n_s_VariantHeaderContigs___setstate __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs___setstate
#define __pyx_n_s_VariantHeaderContigs_add __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_add
#define __pyx_n_s_VariantHeaderContigs_clear_heade __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_clear_heade
#define __pyx_n_s_VariantHeaderContigs_get __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_get
#define __pyx_n_s_VariantHeaderContigs_items __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_items
#define __pyx_n_s_VariantHeaderContigs_iteritems __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_iteritems
#define __pyx_n_s_VariantHeaderContigs_iterkeys __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_iterkeys
#define __pyx_n_s_VariantHeaderContigs_itervalues __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_itervalues
#define __pyx_n_s_VariantHeaderContigs_keys __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_keys
#define __pyx_n_s_VariantHeaderContigs_remove_head __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_remove_head
#define __pyx_n_s_VariantHeaderContigs_values __pyx_mstate_global->__pyx_n_s_VariantHeaderContigs_values
#define __pyx_n_s_VariantHeaderMetadata __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata
#define __pyx_n_u_VariantHeaderMetadata __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata
#define __pyx_n_s_VariantHeaderMetadata___iter __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata___iter
#define __pyx_n_s_VariantHeaderMetadata___reduce_c __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata___reduce_c
#define __pyx_n_s_VariantHeaderMetadata___setstate __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata___setstate
#define __pyx_n_s_VariantHeaderMetadata_add __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_add
#define __pyx_n_s_VariantHeaderMetadata_clear_head __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_clear_head
#define __pyx_n_s_VariantHeaderMetadata_get __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_get
#define __pyx_n_s_VariantHeaderMetadata_items __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_items
#define __pyx_n_s_VariantHeaderMetadata_iteritems __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_iteritems
#define __pyx_n_s_VariantHeaderMetadata_iterkeys __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_iterkeys
#define __pyx_n_s_VariantHeaderMetadata_itervalues __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_itervalues
#define __pyx_n_s_VariantHeaderMetadata_keys __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_keys
#define __pyx_n_s_VariantHeaderMetadata_remove_hea __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_remove_hea
#define __pyx_n_s_VariantHeaderMetadata_values __pyx_mstate_global->__pyx_n_s_VariantHeaderMetadata_values
#define __pyx_n_s_VariantHeaderRecord __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord
#define __pyx_n_u_VariantHeaderRecord __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord
#define __pyx_n_s_VariantHeaderRecord___get___loca __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord___get___loca
#define __pyx_n_s_VariantHeaderRecord___iter __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord___iter
#define __pyx_n_s_VariantHeaderRecord___reduce_cyt __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord___reduce_cyt
#define __pyx_n_s_VariantHeaderRecord___setstate_c __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord___setstate_c
#define __pyx_n_s_VariantHeaderRecord_get __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_get
#define __pyx_n_s_VariantHeaderRecord_items __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_items
#define __pyx_n_s_VariantHeaderRecord_iteritems __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_iteritems
#define __pyx_n_s_VariantHeaderRecord_iterkeys __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_iterkeys
#define __pyx_n_s_VariantHeaderRecord_itervalues __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_itervalues
#define __pyx_n_s_VariantHeaderRecord_keys __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_keys
#define __pyx_n_s_VariantHeaderRecord_pop __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_pop
#define __pyx_n_s_VariantHeaderRecord_remove __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_remove
#define __pyx_n_s_VariantHeaderRecord_update __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_update
#define __pyx_n_s_VariantHeaderRecord_values __pyx_mstate_global->__pyx_n_s_VariantHeaderRecord_values
#define __pyx_n_s_VariantHeaderRecords __pyx_mstate_global->__pyx_n_s_VariantHeaderRecords
#define __pyx_n_u_VariantHeaderRecords __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords
#define __pyx_n_s_VariantHeaderRecords___iter __pyx_mstate_global->__pyx_n_s_VariantHeaderRecords___iter
#define __pyx_n_s_VariantHeaderRecords___reduce_cy __pyx_mstate_global->__pyx_n_s_VariantHeaderRecords___reduce_cy
#define __pyx_n_s_VariantHeaderRecords___setstate __pyx_mstate_global->__pyx_n_s_VariantHeaderRecords___setstate
#define __pyx_n_s_VariantHeaderSamples __pyx_mstate_global->__pyx_n_s_VariantHeaderSamples
#define __pyx_n_u_VariantHeaderSamples __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples
#define __pyx_n_s_VariantHeaderSamples___iter __pyx_mstate_global->__pyx_n_s_VariantHeaderSamples___iter
#define __pyx_n_s_VariantHeaderSamples___reduce_cy __pyx_mstate_global->__pyx_n_s_VariantHeaderSamples___reduce_cy
#define __pyx_n_s_VariantHeaderSamples___setstate __pyx_mstate_global->__pyx_n_s_VariantHeaderSamples___setstate
#define __pyx_n_s_VariantHeaderSamples_add __pyx_mstate_global->__pyx_n_s_VariantHeaderSamples_add
#define __pyx_n_s_VariantHeader___reduce_cython __pyx_mstate_global->__pyx_n_s_VariantHeader___reduce_cython
#define __pyx_n_s_VariantHeader___setstate_cython __pyx_mstate_global->__pyx_n_s_VariantHeader___setstate_cython
#define __pyx_n_s_VariantHeader_add_line __pyx_mstate_global->__pyx_n_s_VariantHeader_add_line
#define __pyx_n_s_VariantHeader_add_meta __pyx_mstate_global->__pyx_n_s_VariantHeader_add_meta
#define __pyx_n_s_VariantHeader_add_record __pyx_mstate_global->__pyx_n_s_VariantHeader_add_record
#define __pyx_n_s_VariantHeader_add_sample __pyx_mstate_global->__pyx_n_s_VariantHeader_add_sample
#define __pyx_n_s_VariantHeader_add_samples __pyx_mstate_global->__pyx_n_s_VariantHeader_add_samples
#define __pyx_n_s_VariantHeader_copy __pyx_mstate_global->__pyx_n_s_VariantHeader_copy
#define __pyx_n_s_VariantHeader_merge __pyx_mstate_global->__pyx_n_s_VariantHeader_merge
#define __pyx_n_s_VariantHeader_new_record __pyx_mstate_global->__pyx_n_s_VariantHeader_new_record
#define __pyx_n_s_VariantMetadata __pyx_mstate_global->__pyx_n_s_VariantMetadata
#define __pyx_n_u_VariantMetadata __pyx_mstate_global->__pyx_n_u_VariantMetadata
#define __pyx_n_s_VariantMetadata___reduce_cython __pyx_mstate_global->__pyx_n_s_VariantMetadata___reduce_cython
#define __pyx_n_s_VariantMetadata___setstate_cytho __pyx_mstate_global->__pyx_n_s_VariantMetadata___setstate_cytho
#define __pyx_n_s_VariantMetadata_remove_header __pyx_mstate_global->__pyx_n_s_VariantMetadata_remove_header
#define __pyx_n_s_VariantRecord __pyx_mstate_global->__pyx_n_s_VariantRecord
#define __pyx_n_u_VariantRecord __pyx_mstate_global->__pyx_n_u_VariantRecord
#define __pyx_n_s_VariantRecordFilter __pyx_mstate_global->__pyx_n_s_VariantRecordFilter
#define __pyx_n_u_VariantRecordFilter __pyx_mstate_global->__pyx_n_u_VariantRecordFilter
#define __pyx_n_s_VariantRecordFilter___iter __pyx_mstate_global->__pyx_n_s_VariantRecordFilter___iter
#define __pyx_n_s_VariantRecordFilter___reduce_cyt __pyx_mstate_global->__pyx_n_s_VariantRecordFilter___reduce_cyt
#define __pyx_n_s_VariantRecordFilter___setstate_c __pyx_mstate_global->__pyx_n_s_VariantRecordFilter___setstate_c
#define __pyx_n_s_VariantRecordFilter_add __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_add
#define __pyx_n_s_VariantRecordFilter_clear __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_clear
#define __pyx_n_s_VariantRecordFilter_get __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_get
#define __pyx_n_s_VariantRecordFilter_items __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_items
#define __pyx_n_s_VariantRecordFilter_iteritems __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_iteritems
#define __pyx_n_s_VariantRecordFilter_iterkeys __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_iterkeys
#define __pyx_n_s_VariantRecordFilter_itervalues __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_itervalues
#define __pyx_n_s_VariantRecordFilter_keys __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_keys
#define __pyx_n_s_VariantRecordFilter_values __pyx_mstate_global->__pyx_n_s_VariantRecordFilter_values
#define __pyx_n_s_VariantRecordFormat __pyx_mstate_global->__pyx_n_s_VariantRecordFormat
#define __pyx_n_u_VariantRecordFormat __pyx_mstate_global->__pyx_n_u_VariantRecordFormat
#define __pyx_n_s_VariantRecordFormat___iter __pyx_mstate_global->__pyx_n_s_VariantRecordFormat___iter
#define __pyx_n_s_VariantRecordFormat___reduce_cyt __pyx_mstate_global->__pyx_n_s_VariantRecordFormat___reduce_cyt
#define __pyx_n_s_VariantRecordFormat___setstate_c __pyx_mstate_global->__pyx_n_s_VariantRecordFormat___setstate_c
#define __pyx_n_s_VariantRecordFormat_clear __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_clear
#define __pyx_n_s_VariantRecordFormat_get __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_get
#define __pyx_n_s_VariantRecordFormat_items __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_items
#define __pyx_n_s_VariantRecordFormat_iteritems __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_iteritems
#define __pyx_n_s_VariantRecordFormat_iterkeys __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_iterkeys
#define __pyx_n_s_VariantRecordFormat_itervalues __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_itervalues
#define __pyx_n_s_VariantRecordFormat_keys __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_keys
#define __pyx_n_s_VariantRecordFormat_values __pyx_mstate_global->__pyx_n_s_VariantRecordFormat_values
#define __pyx_n_s_VariantRecordInfo __pyx_mstate_global->__pyx_n_s_VariantRecordInfo
#define __pyx_n_u_VariantRecordInfo __pyx_mstate_global->__pyx_n_u_VariantRecordInfo
#define __pyx_n_s_VariantRecordInfo___iter __pyx_mstate_global->__pyx_n_s_VariantRecordInfo___iter
#define __pyx_n_s_VariantRecordInfo___reduce_cytho __pyx_mstate_global->__pyx_n_s_VariantRecordInfo___reduce_cytho
#define __pyx_n_s_VariantRecordInfo___setstate_cyt __pyx_mstate_global->__pyx_n_s_VariantRecordInfo___setstate_cyt
#define __pyx_n_s_VariantRecordInfo_clear __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_clear
#define __pyx_n_s_VariantRecordInfo_get __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_get
#define __pyx_n_s_VariantRecordInfo_items __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_items
#define __pyx_n_s_VariantRecordInfo_iteritems __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_iteritems
#define __pyx_n_s_VariantRecordInfo_iterkeys __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_iterkeys
#define __pyx_n_s_VariantRecordInfo_itervalues __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_itervalues
#define __pyx_n_s_VariantRecordInfo_keys __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_keys
#define __pyx_n_s_VariantRecordInfo_pop __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_pop
#define __pyx_n_s_VariantRecordInfo_update __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_update
#define __pyx_n_s_VariantRecordInfo_values __pyx_mstate_global->__pyx_n_s_VariantRecordInfo_values
#define __pyx_n_s_VariantRecordSample __pyx_mstate_global->__pyx_n_s_VariantRecordSample
#define __pyx_n_u_VariantRecordSample __pyx_mstate_global->__pyx_n_u_VariantRecordSample
#define __pyx_n_s_VariantRecordSample___iter __pyx_mstate_global->__pyx_n_s_VariantRecordSample___iter
#define __pyx_n_s_VariantRecordSample___reduce_cyt __pyx_mstate_global->__pyx_n_s_VariantRecordSample___reduce_cyt
#define __pyx_n_s_VariantRecordSample___set___loca __pyx_mstate_global->__pyx_n_s_VariantRecordSample___set___loca
#define __pyx_n_s_VariantRecordSample___setstate_c __pyx_mstate_global->__pyx_n_s_VariantRecordSample___setstate_c
#define __pyx_n_s_VariantRecordSample_clear __pyx_mstate_global->__pyx_n_s_VariantRecordSample_clear
#define __pyx_n_s_VariantRecordSample_get __pyx_mstate_global->__pyx_n_s_VariantRecordSample_get
#define __pyx_n_s_VariantRecordSample_items __pyx_mstate_global->__pyx_n_s_VariantRecordSample_items
#define __pyx_n_s_VariantRecordSample_iteritems __pyx_mstate_global->__pyx_n_s_VariantRecordSample_iteritems
#define __pyx_n_s_VariantRecordSample_iterkeys __pyx_mstate_global->__pyx_n_s_VariantRecordSample_iterkeys
#define __pyx_n_s_VariantRecordSample_itervalues __pyx_mstate_global->__pyx_n_s_VariantRecordSample_itervalues
#define __pyx_n_s_VariantRecordSample_keys __pyx_mstate_global->__pyx_n_s_VariantRecordSample_keys
#define __pyx_n_s_VariantRecordSample_pop __pyx_mstate_global->__pyx_n_s_VariantRecordSample_pop
#define __pyx_n_s_VariantRecordSample_update __pyx_mstate_global->__pyx_n_s_VariantRecordSample_update
#define __pyx_n_s_VariantRecordSample_values __pyx_mstate_global->__pyx_n_s_VariantRecordSample_values
#define __pyx_n_s_VariantRecordSamples __pyx_mstate_global->__pyx_n_s_VariantRecordSamples
#define __pyx_n_u_VariantRecordSamples __pyx_mstate_global->__pyx_n_u_VariantRecordSamples
#define __pyx_n_s_VariantRecordSamples___iter __pyx_mstate_global->__pyx_n_s_VariantRecordSamples___iter
#define __pyx_n_s_VariantRecordSamples___reduce_cy __pyx_mstate_global->__pyx_n_s_VariantRecordSamples___reduce_cy
#define __pyx_n_s_VariantRecordSamples___setstate __pyx_mstate_global->__pyx_n_s_VariantRecordSamples___setstate
#define __pyx_n_s_VariantRecordSamples_get __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_get
#define __pyx_n_s_VariantRecordSamples_items __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_items
#define __pyx_n_s_VariantRecordSamples_iteritems __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_iteritems
#define __pyx_n_s_VariantRecordSamples_iterkeys __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_iterkeys
#define __pyx_n_s_VariantRecordSamples_itervalues __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_itervalues
#define __pyx_n_s_VariantRecordSamples_keys __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_keys
#define __pyx_n_s_VariantRecordSamples_pop __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_pop
#define __pyx_n_s_VariantRecordSamples_update __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_update
#define __pyx_n_s_VariantRecordSamples_values __pyx_mstate_global->__pyx_n_s_VariantRecordSamples_values
#define __pyx_n_s_VariantRecord___reduce_cython __pyx_mstate_global->__pyx_n_s_VariantRecord___reduce_cython
#define __pyx_n_s_VariantRecord___setstate_cython __pyx_mstate_global->__pyx_n_s_VariantRecord___setstate_cython
#define __pyx_n_s_VariantRecord_copy __pyx_mstate_global->__pyx_n_s_VariantRecord_copy
#define __pyx_n_s_VariantRecord_translate __pyx_mstate_global->__pyx_n_s_VariantRecord_translate
#define __pyx_kp_b__12 __pyx_mstate_global->__pyx_kp_b__12
#define __pyx_kp_u__12 __pyx_mstate_global->__pyx_kp_u__12
#define __pyx_kp_u__181 __pyx_mstate_global->__pyx_kp_u__181
#define __pyx_kp_b__2 __pyx_mstate_global->__pyx_kp_b__2
#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2
#define __pyx_kp_b__241 __pyx_mstate_global->__pyx_kp_b__241
#define __pyx_n_s__278 __pyx_mstate_global->__pyx_n_s__278
#define __pyx_n_s__323 __pyx_mstate_global->__pyx_n_s__323
#define __pyx_n_s__330 __pyx_mstate_global->__pyx_n_s__330
#define __pyx_kp_b__52 __pyx_mstate_global->__pyx_kp_b__52
#define __pyx_kp_u__52 __pyx_mstate_global->__pyx_kp_u__52
#define __pyx_kp_u__53 __pyx_mstate_global->__pyx_kp_u__53
#define __pyx_n_s_add __pyx_mstate_global->__pyx_n_s_add
#define __pyx_n_s_add_line __pyx_mstate_global->__pyx_n_s_add_line
#define __pyx_n_s_add_meta __pyx_mstate_global->__pyx_n_s_add_meta
#define __pyx_n_s_add_record __pyx_mstate_global->__pyx_n_s_add_record
#define __pyx_n_s_add_sample __pyx_mstate_global->__pyx_n_s_add_sample
#define __pyx_n_s_add_samples __pyx_mstate_global->__pyx_n_s_add_samples
#define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
#define __pyx_n_s_alleles __pyx_mstate_global->__pyx_n_s_alleles
#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append
#define __pyx_n_s_arg __pyx_mstate_global->__pyx_n_s_arg
#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
#define __pyx_n_s_bcf __pyx_mstate_global->__pyx_n_s_bcf
#define __pyx_kp_u_bcf_2 __pyx_mstate_global->__pyx_kp_u_bcf_2
#define __pyx_n_s_bcf_array_to_object_locals_genex __pyx_mstate_global->__pyx_n_s_bcf_array_to_object_locals_genex
#define __pyx_n_s_bcf_check_values_locals_genexpr __pyx_mstate_global->__pyx_n_s_bcf_check_values_locals_genexpr
#define __pyx_kp_u_bcf_hdr_format_failed __pyx_mstate_global->__pyx_kp_u_bcf_hdr_format_failed
#define __pyx_kp_u_bcf_hdr_set_samples_failed_ret __pyx_mstate_global->__pyx_kp_u_bcf_hdr_set_samples_failed_ret
#define __pyx_kp_u_bcf_index_required __pyx_mstate_global->__pyx_kp_u_bcf_index_required
#define __pyx_kp_u_bcf_must_not_be_None __pyx_mstate_global->__pyx_kp_u_bcf_must_not_be_None
#define __pyx_n_s_bcf_object_to_array_locals_genex __pyx_mstate_global->__pyx_n_s_bcf_object_to_array_locals_genex
#define __pyx_n_u_bcguz __pyx_mstate_global->__pyx_n_u_bcguz
#define __pyx_n_u_bcguz0123456789ex __pyx_mstate_global->__pyx_n_u_bcguz0123456789ex
#define __pyx_n_s_bgzfp __pyx_mstate_global->__pyx_n_s_bgzfp
#define __pyx_n_s_bkey __pyx_mstate_global->__pyx_n_s_bkey
#define __pyx_n_s_bline __pyx_mstate_global->__pyx_n_s_bline
#define __pyx_kp_u_cannot_convert_deleted_record_to __pyx_mstate_global->__pyx_kp_u_cannot_convert_deleted_record_to
#define __pyx_kp_u_cannot_create_VariantHeader __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantHeader
#define __pyx_kp_u_cannot_create_VariantRecord __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantRecord
#define __pyx_kp_u_cannot_create_VariantRecordSampl __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantRecordSampl
#define __pyx_kp_u_cannot_fetch_from_Variantfile_op __pyx_mstate_global->__pyx_kp_u_cannot_fetch_from_Variantfile_op
#define __pyx_kp_u_cannot_find_metadata_key __pyx_mstate_global->__pyx_kp_u_cannot_find_metadata_key
#define __pyx_kp_u_cannot_iterate_over_Variantfile __pyx_mstate_global->__pyx_kp_u_cannot_iterate_over_Variantfile
#define __pyx_kp_u_cannot_set_null_allele __pyx_mstate_global->__pyx_kp_u_cannot_set_null_allele
#define __pyx_kp_u_cannot_set_null_alt_allele __pyx_mstate_global->__pyx_kp_u_cannot_set_null_alt_allele
#define __pyx_kp_u_cannot_subset_samples_after_fetc __pyx_mstate_global->__pyx_kp_u_cannot_subset_samples_after_fetc
#define __pyx_kp_u_cannot_subset_samples_from_Varia __pyx_mstate_global->__pyx_kp_u_cannot_subset_samples_from_Varia
#define __pyx_kp_u_cannot_write_to_a_Variantfile_op __pyx_mstate_global->__pyx_kp_u_cannot_write_to_a_Variantfile_op
#define __pyx_n_s_cfilename __pyx_mstate_global->__pyx_n_s_cfilename
#define __pyx_n_s_char_array_to_tuple_locals_genex __pyx_mstate_global->__pyx_n_s_char_array_to_tuple_locals_genex
#define __pyx_n_s_check_truncation __pyx_mstate_global->__pyx_n_s_check_truncation
#define __pyx_n_s_chr __pyx_mstate_global->__pyx_n_s_chr
#define __pyx_n_s_cindex_filename __pyx_mstate_global->__pyx_n_s_cindex_filename
#define __pyx_n_s_ckey __pyx_mstate_global->__pyx_n_s_ckey
#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
#define __pyx_n_s_clear __pyx_mstate_global->__pyx_n_s_clear
#define __pyx_n_s_clear_header __pyx_mstate_global->__pyx_n_s_clear_header
#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
#define __pyx_n_s_cmode __pyx_mstate_global->__pyx_n_s_cmode
#define __pyx_n_s_contig __pyx_mstate_global->__pyx_n_s_contig
#define __pyx_n_u_contig __pyx_mstate_global->__pyx_n_u_contig
#define __pyx_kp_u_contig_must_be_specified __pyx_mstate_global->__pyx_kp_u_contig_must_be_specified
#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy
#define __pyx_kp_u_could_not_open_file_mode __pyx_mstate_global->__pyx_kp_u_could_not_open_file_mode
#define __pyx_kp_u_could_not_open_variant_file __pyx_mstate_global->__pyx_kp_u_could_not_open_variant_file
#define __pyx_kp_u_could_not_open_variant_file_2 __pyx_mstate_global->__pyx_kp_u_could_not_open_variant_file_2
#define __pyx_n_s_d __pyx_mstate_global->__pyx_n_s_d
#define __pyx_n_s_default __pyx_mstate_global->__pyx_n_s_default
#define __pyx_n_s_description __pyx_mstate_global->__pyx_n_s_description
#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict
#define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2
#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
#define __pyx_n_s_drop_samples __pyx_mstate_global->__pyx_n_s_drop_samples
#define __pyx_n_s_dst_hdr __pyx_mstate_global->__pyx_n_s_dst_hdr
#define __pyx_n_s_dst_header __pyx_mstate_global->__pyx_n_s_dst_header
#define __pyx_kp_u_dst_header_must_not_be_None __pyx_mstate_global->__pyx_kp_u_dst_header_must_not_be_None
#define __pyx_n_s_duplicate_filehandle __pyx_mstate_global->__pyx_n_s_duplicate_filehandle
#define __pyx_kp_u_either_value_or_items_must_be_sp __pyx_mstate_global->__pyx_kp_u_either_value_or_items_must_be_sp
#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
#define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
#define __pyx_n_s_endswith __pyx_mstate_global->__pyx_n_s_endswith
#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate
#define __pyx_kp_u_error_in_bcf_subset_format __pyx_mstate_global->__pyx_kp_u_error_in_bcf_subset_format
#define __pyx_kp_u_error_in_vcf_parse __pyx_mstate_global->__pyx_kp_u_error_in_vcf_parse
#define __pyx_n_s_f __pyx_mstate_global->__pyx_n_s_f
#define __pyx_n_s_fetch __pyx_mstate_global->__pyx_n_s_fetch
#define __pyx_kp_u_fetch_requires_an_index __pyx_mstate_global->__pyx_kp_u_fetch_requires_an_index
#define __pyx_kp_u_file_does_not_have_valid_header __pyx_mstate_global->__pyx_kp_u_file_does_not_have_valid_header
#define __pyx_n_s_filename __pyx_mstate_global->__pyx_n_s_filename
#define __pyx_n_s_filter __pyx_mstate_global->__pyx_n_s_filter
#define __pyx_n_s_fmt __pyx_mstate_global->__pyx_n_s_fmt
#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
#define __pyx_n_s_format_modes __pyx_mstate_global->__pyx_n_s_format_modes
#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
#define __pyx_n_s_genexpr __pyx_mstate_global->__pyx_n_s_genexpr
#define __pyx_kp_u_genotype_is_only_valid_as_a_form __pyx_mstate_global->__pyx_kp_u_genotype_is_only_valid_as_a_form
#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get
#define __pyx_n_s_get_reference_name __pyx_mstate_global->__pyx_n_s_get_reference_name
#define __pyx_n_s_get_tid __pyx_mstate_global->__pyx_n_s_get_tid
#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
#define __pyx_kp_u_gz __pyx_mstate_global->__pyx_kp_u_gz
#define __pyx_n_s_hash __pyx_mstate_global->__pyx_n_s_hash
#define __pyx_n_s_hdr __pyx_mstate_global->__pyx_n_s_hdr
#define __pyx_n_s_header __pyx_mstate_global->__pyx_n_s_header
#define __pyx_kp_u_header_must_not_be_None __pyx_mstate_global->__pyx_kp_u_header_must_not_be_None
#define __pyx_n_s_hrec __pyx_mstate_global->__pyx_n_s_hrec
#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id
#define __pyx_n_s_idx __pyx_mstate_global->__pyx_n_s_idx
#define __pyx_n_s_ignore_truncation __pyx_mstate_global->__pyx_n_s_ignore_truncation
#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
#define __pyx_n_s_include_samples __pyx_mstate_global->__pyx_n_s_include_samples
#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index
#define __pyx_n_s_index_filename __pyx_mstate_global->__pyx_n_s_index_filename
#define __pyx_n_s_info __pyx_mstate_global->__pyx_n_s_info
#define __pyx_n_s_info_id __pyx_mstate_global->__pyx_n_s_info_id
#define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init
#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
#define __pyx_kp_u_invalid_FORMAT __pyx_mstate_global->__pyx_kp_u_invalid_FORMAT
#define __pyx_kp_u_invalid_VariantHeader __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader
#define __pyx_kp_u_invalid_VariantRecord __pyx_mstate_global->__pyx_kp_u_invalid_VariantRecord
#define __pyx_kp_u_invalid_character_found __pyx_mstate_global->__pyx_kp_u_invalid_character_found
#define __pyx_kp_u_invalid_contig __pyx_mstate_global->__pyx_kp_u_invalid_contig
#define __pyx_kp_u_invalid_contig_2 __pyx_mstate_global->__pyx_kp_u_invalid_contig_2
#define __pyx_kp_u_invalid_contig_id __pyx_mstate_global->__pyx_kp_u_invalid_contig_id
#define __pyx_kp_u_invalid_contig_index __pyx_mstate_global->__pyx_kp_u_invalid_contig_index
#define __pyx_kp_u_invalid_file_mode_is_it_VCF_BCF __pyx_mstate_global->__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF
#define __pyx_kp_u_invalid_filter_index __pyx_mstate_global->__pyx_kp_u_invalid_filter_index
#define __pyx_kp_u_invalid_header_line __pyx_mstate_global->__pyx_kp_u_invalid_header_line
#define __pyx_kp_u_invalid_header_record_index __pyx_mstate_global->__pyx_kp_u_invalid_header_record_index
#define __pyx_kp_u_invalid_key __pyx_mstate_global->__pyx_kp_u_invalid_key
#define __pyx_kp_u_invalid_metadata_id __pyx_mstate_global->__pyx_kp_u_invalid_metadata_id
#define __pyx_kp_u_invalid_metadata_type __pyx_mstate_global->__pyx_kp_u_invalid_metadata_type
#define __pyx_kp_u_invalid_mode_options __pyx_mstate_global->__pyx_kp_u_invalid_mode_options
#define __pyx_n_s_invalid_modes __pyx_mstate_global->__pyx_n_s_invalid_modes
#define __pyx_kp_u_invalid_number_of_columns __pyx_mstate_global->__pyx_kp_u_invalid_number_of_columns
#define __pyx_kp_u_invalid_reference_id __pyx_mstate_global->__pyx_kp_u_invalid_reference_id
#define __pyx_kp_u_invalid_sample_index __pyx_mstate_global->__pyx_kp_u_invalid_sample_index
#define __pyx_kp_u_invalid_sample_name __pyx_mstate_global->__pyx_kp_u_invalid_sample_name
#define __pyx_kp_u_invalid_tag __pyx_mstate_global->__pyx_kp_u_invalid_tag
#define __pyx_kp_u_invalid_value_for_Float_format __pyx_mstate_global->__pyx_kp_u_invalid_value_for_Float_format
#define __pyx_kp_u_invalid_value_for_Integer_format __pyx_mstate_global->__pyx_kp_u_invalid_value_for_Integer_format
#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
#define __pyx_n_s_is_open __pyx_mstate_global->__pyx_n_s_is_open
#define __pyx_n_s_is_valid_tid __pyx_mstate_global->__pyx_n_s_is_valid_tid
#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
#define __pyx_n_s_items __pyx_mstate_global->__pyx_n_s_items
#define __pyx_n_s_iter __pyx_mstate_global->__pyx_n_s_iter
#define __pyx_n_s_iteritems __pyx_mstate_global->__pyx_n_s_iteritems
#define __pyx_n_s_iterkeys __pyx_mstate_global->__pyx_n_s_iterkeys
#define __pyx_n_s_itervalues __pyx_mstate_global->__pyx_n_s_itervalues
#define __pyx_n_s_join __pyx_mstate_global->__pyx_n_s_join
#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k
#define __pyx_n_s_key __pyx_mstate_global->__pyx_n_s_key
#define __pyx_n_s_keys __pyx_mstate_global->__pyx_n_s_keys
#define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs
#define __pyx_n_s_length __pyx_mstate_global->__pyx_n_s_length
#define __pyx_n_u_length __pyx_mstate_global->__pyx_n_u_length
#define __pyx_kp_u_limits_violated __pyx_mstate_global->__pyx_kp_u_limits_violated
#define __pyx_n_s_line __pyx_mstate_global->__pyx_n_s_line
#define __pyx_n_s_m __pyx_mstate_global->__pyx_n_s_m
#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
#define __pyx_n_s_merge __pyx_mstate_global->__pyx_n_s_merge
#define __pyx_kp_u_missing_d_requested_samples __pyx_mstate_global->__pyx_kp_u_missing_d_requested_samples
#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
#define __pyx_kp_u_mode_contains_conflicting_format __pyx_mstate_global->__pyx_kp_u_mode_contains_conflicting_format
#define __pyx_kp_u_mode_must_begin_with_r_w_or_a __pyx_mstate_global->__pyx_kp_u_mode_must_begin_with_r_w_or_a
#define __pyx_n_s_msg __pyx_mstate_global->__pyx_n_s_msg
#define __pyx_kp_u_must_set_at_least_2_alleles __pyx_mstate_global->__pyx_kp_u_must_set_at_least_2_alleles
#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new
#define __pyx_n_s_new_record __pyx_mstate_global->__pyx_n_s_new_record
#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non
#define __pyx_n_s_number __pyx_mstate_global->__pyx_n_s_number
#define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object
#define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open
#define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os
#define __pyx_n_s_parse_region __pyx_mstate_global->__pyx_n_s_parse_region
#define __pyx_n_s_phased __pyx_mstate_global->__pyx_n_s_phased
#define __pyx_n_u_phased __pyx_mstate_global->__pyx_n_u_phased
#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle
#define __pyx_n_s_pop __pyx_mstate_global->__pyx_n_s_pop
#define __pyx_n_s_pysam_libcbcf __pyx_mstate_global->__pyx_n_s_pysam_libcbcf
#define __pyx_kp_s_pysam_libcbcf_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libcbcf_pyx
#define __pyx_n_s_pysam_utils __pyx_mstate_global->__pyx_n_s_pysam_utils
#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError
#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum
#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result
#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state
#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type
#define __pyx_n_s_pyx_unpickle_BaseIndex __pyx_mstate_global->__pyx_n_s_pyx_unpickle_BaseIndex
#define __pyx_n_s_pyx_unpickle_VariantContig __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantContig
#define __pyx_n_s_pyx_unpickle_VariantHeaderCont __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantHeaderCont
#define __pyx_n_s_pyx_unpickle_VariantHeaderMeta __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantHeaderMeta
#define __pyx_n_s_pyx_unpickle_VariantHeaderReco __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantHeaderReco
#define __pyx_n_s_pyx_unpickle_VariantHeaderSamp __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantHeaderSamp
#define __pyx_n_s_pyx_unpickle_VariantMetadata __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantMetadata
#define __pyx_n_s_pyx_unpickle_VariantRecordFilt __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantRecordFilt
#define __pyx_n_s_pyx_unpickle_VariantRecordForm __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantRecordForm
#define __pyx_n_s_pyx_unpickle_VariantRecordInfo __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantRecordInfo
#define __pyx_n_s_pyx_unpickle_VariantRecordSamp __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantRecordSamp
#define __pyx_n_s_pyx_unpickle_VariantRecordSamp_2 __pyx_mstate_global->__pyx_n_s_pyx_unpickle_VariantRecordSamp_2
#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
#define __pyx_n_s_qual __pyx_mstate_global->__pyx_n_s_qual
#define __pyx_n_s_quoted __pyx_mstate_global->__pyx_n_s_quoted
#define __pyx_n_b_r __pyx_mstate_global->__pyx_n_b_r
#define __pyx_n_s_r __pyx_mstate_global->__pyx_n_s_r
#define __pyx_n_u_r __pyx_mstate_global->__pyx_n_u_r
#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
#define __pyx_n_s_rec __pyx_mstate_global->__pyx_n_s_rec
#define __pyx_n_s_record __pyx_mstate_global->__pyx_n_s_record
#define __pyx_kp_u_record_must_not_be_None __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None
#define __pyx_n_s_records __pyx_mstate_global->__pyx_n_s_records
#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce
#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython
#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex
#define __pyx_n_s_ref __pyx_mstate_global->__pyx_n_s_ref
#define __pyx_kp_u_ref_allele_must_not_be_null __pyx_mstate_global->__pyx_kp_u_ref_allele_must_not_be_null
#define __pyx_n_s_reference __pyx_mstate_global->__pyx_n_s_reference
#define __pyx_n_s_region __pyx_mstate_global->__pyx_n_s_region
#define __pyx_n_s_remap __pyx_mstate_global->__pyx_n_s_remap
#define __pyx_n_s_remove __pyx_mstate_global->__pyx_n_s_remove
#define __pyx_n_s_remove_header __pyx_mstate_global->__pyx_n_s_remove_header
#define __pyx_n_s_reopen __pyx_mstate_global->__pyx_n_s_reopen
#define __pyx_n_s_reset __pyx_mstate_global->__pyx_n_s_reset
#define __pyx_n_s_ret __pyx_mstate_global->__pyx_n_s_ret
#define __pyx_n_s_reversed __pyx_mstate_global->__pyx_n_s_reversed
#define __pyx_n_s_rid __pyx_mstate_global->__pyx_n_s_rid
#define __pyx_n_u_rwa __pyx_mstate_global->__pyx_n_u_rwa
#define __pyx_n_s_sample __pyx_mstate_global->__pyx_n_s_sample
#define __pyx_kp_u_sample_must_not_be_None __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None
#define __pyx_n_s_samples __pyx_mstate_global->__pyx_n_s_samples
#define __pyx_n_s_seek __pyx_mstate_global->__pyx_n_s_seek
#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
#define __pyx_kp_s_self_iter_cannot_be_converted_to __pyx_mstate_global->__pyx_kp_s_self_iter_cannot_be_converted_to
#define __pyx_kp_s_self_ptr_cannot_be_converted_to __pyx_mstate_global->__pyx_kp_s_self_ptr_cannot_be_converted_to
#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send
#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate
#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython
#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
#define __pyx_n_s_split __pyx_mstate_global->__pyx_n_s_split
#define __pyx_n_s_src_hdr __pyx_mstate_global->__pyx_n_s_src_hdr
#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
#define __pyx_n_s_startswith __pyx_mstate_global->__pyx_n_s_startswith
#define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state
#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource
#define __pyx_n_s_strip __pyx_mstate_global->__pyx_n_s_strip
#define __pyx_n_s_subset_samples __pyx_mstate_global->__pyx_n_s_subset_samples
#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys
#define __pyx_kp_u_tabix_index_required __pyx_mstate_global->__pyx_kp_u_tabix_index_required
#define __pyx_n_s_tell __pyx_mstate_global->__pyx_n_s_tell
#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
#define __pyx_kp_u_this_class_cannot_be_instantiate __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate
#define __pyx_n_s_threads __pyx_mstate_global->__pyx_n_s_threads
#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw
#define __pyx_n_s_tid __pyx_mstate_global->__pyx_n_s_tid
#define __pyx_n_s_tidx __pyx_mstate_global->__pyx_n_s_tidx
#define __pyx_n_s_translate __pyx_mstate_global->__pyx_n_s_translate
#define __pyx_kp_u_truncated_file __pyx_mstate_global->__pyx_kp_u_truncated_file
#define __pyx_n_s_type __pyx_mstate_global->__pyx_n_s_type
#define __pyx_kp_u_unable_to_allocate_BCF_record __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_BCF_record
#define __pyx_kp_u_unable_to_fetch __pyx_mstate_global->__pyx_kp_u_unable_to_fetch
#define __pyx_kp_u_unable_to_fetch_next_record __pyx_mstate_global->__pyx_kp_u_unable_to_fetch_next_record
#define __pyx_kp_u_unable_to_parse_next_record __pyx_mstate_global->__pyx_kp_u_unable_to_parse_next_record
#define __pyx_kp_u_unable_to_reallocate_VariantHead __pyx_mstate_global->__pyx_kp_u_unable_to_reallocate_VariantHead
#define __pyx_kp_u_unknown_INFO __pyx_mstate_global->__pyx_kp_u_unknown_INFO
#define __pyx_kp_u_unknown_format __pyx_mstate_global->__pyx_kp_u_unknown_format
#define __pyx_kp_u_unknown_mode __pyx_mstate_global->__pyx_kp_u_unknown_mode
#define __pyx_kp_u_unknown_type_specified __pyx_mstate_global->__pyx_kp_u_unknown_type_specified
#define __pyx_n_s_unquoted_str __pyx_mstate_global->__pyx_n_s_unquoted_str
#define __pyx_kp_u_unsupported_header_type_code __pyx_mstate_global->__pyx_kp_u_unsupported_header_type_code
#define __pyx_kp_u_unsupported_info_type_code __pyx_mstate_global->__pyx_kp_u_unsupported_info_type_code
#define __pyx_kp_u_unsupported_type __pyx_mstate_global->__pyx_kp_u_unsupported_type
#define __pyx_kp_u_unsupported_types __pyx_mstate_global->__pyx_kp_u_unsupported_types
#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update
#define __pyx_n_s_upper __pyx_mstate_global->__pyx_n_s_upper
#define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate
#define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8
#define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v
#define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value
#define __pyx_kp_u_value_expected_to_be_scalar_give __pyx_mstate_global->__pyx_kp_u_value_expected_to_be_scalar_give
#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values
#define __pyx_kp_u_values_expected_to_be_tuple_give __pyx_mstate_global->__pyx_kp_u_values_expected_to_be_tuple_give
#define __pyx_n_s_vars __pyx_mstate_global->__pyx_n_s_vars
#define __pyx_kp_u_vcf_format_failed __pyx_mstate_global->__pyx_kp_u_vcf_format_failed
#define __pyx_n_b_w __pyx_mstate_global->__pyx_n_b_w
#define __pyx_n_u_w __pyx_mstate_global->__pyx_n_u_w
#define __pyx_n_u_wb __pyx_mstate_global->__pyx_n_u_wb
#define __pyx_n_u_wb0 __pyx_mstate_global->__pyx_n_u_wb0
#define __pyx_n_u_wbu __pyx_mstate_global->__pyx_n_u_wbu
#define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write
#define __pyx_n_u_wz __pyx_mstate_global->__pyx_n_u_wz
#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2
#define __pyx_int_10091417 __pyx_mstate_global->__pyx_int_10091417
#define __pyx_int_10698032 __pyx_mstate_global->__pyx_int_10698032
#define __pyx_int_31479882 __pyx_mstate_global->__pyx_int_31479882
#define __pyx_int_33440904 __pyx_mstate_global->__pyx_int_33440904
#define __pyx_int_39264352 __pyx_mstate_global->__pyx_int_39264352
#define __pyx_int_41264896 __pyx_mstate_global->__pyx_int_41264896
#define __pyx_int_93650198 __pyx_mstate_global->__pyx_int_93650198
#define __pyx_int_94171383 __pyx_mstate_global->__pyx_int_94171383
#define __pyx_int_97976187 __pyx_mstate_global->__pyx_int_97976187
#define __pyx_int_118286449 __pyx_mstate_global->__pyx_int_118286449
#define __pyx_int_126454353 __pyx_mstate_global->__pyx_int_126454353
#define __pyx_int_135711299 __pyx_mstate_global->__pyx_int_135711299
#define __pyx_int_145625440 __pyx_mstate_global->__pyx_int_145625440
#define __pyx_int_164668780 __pyx_mstate_global->__pyx_int_164668780
#define __pyx_int_168021462 __pyx_mstate_global->__pyx_int_168021462
#define __pyx_int_199651019 __pyx_mstate_global->__pyx_int_199651019
#define __pyx_int_215036767 __pyx_mstate_global->__pyx_int_215036767
#define __pyx_int_227765731 __pyx_mstate_global->__pyx_int_227765731
#define __pyx_int_232881935 __pyx_mstate_global->__pyx_int_232881935
#define __pyx_int_248899179 __pyx_mstate_global->__pyx_int_248899179
#define __pyx_int_250317299 __pyx_mstate_global->__pyx_int_250317299
#define __pyx_int_4294967294 __pyx_mstate_global->__pyx_int_4294967294
#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
#define __pyx_k__41 __pyx_mstate_global->__pyx_k__41
#define __pyx_k__146 __pyx_mstate_global->__pyx_k__146
#define __pyx_k__158 __pyx_mstate_global->__pyx_k__158
#define __pyx_k__193 __pyx_mstate_global->__pyx_k__193
#define __pyx_k__206 __pyx_mstate_global->__pyx_k__206
#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3
#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7
#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8
#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10
#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11
#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14
#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17
#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18
#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20
#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21
#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23
#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24
#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25
#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26
#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28
#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29
#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30
#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31
#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32
#define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43
#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47
#define __pyx_tuple__48 __pyx_mstate_global->__pyx_tuple__48
#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51
#define __pyx_tuple__57 __pyx_mstate_global->__pyx_tuple__57
#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58
#define __pyx_tuple__60 __pyx_mstate_global->__pyx_tuple__60
#define __pyx_tuple__61 __pyx_mstate_global->__pyx_tuple__61
#define __pyx_tuple__76 __pyx_mstate_global->__pyx_tuple__76
#define __pyx_tuple__77 __pyx_mstate_global->__pyx_tuple__77
#define __pyx_tuple__88 __pyx_mstate_global->__pyx_tuple__88
#define __pyx_tuple__91 __pyx_mstate_global->__pyx_tuple__91
#define __pyx_tuple__95 __pyx_mstate_global->__pyx_tuple__95
#define __pyx_tuple__98 __pyx_mstate_global->__pyx_tuple__98
#define __pyx_slice__240 __pyx_mstate_global->__pyx_slice__240
#define __pyx_tuple__100 __pyx_mstate_global->__pyx_tuple__100
#define __pyx_tuple__103 __pyx_mstate_global->__pyx_tuple__103
#define __pyx_tuple__105 __pyx_mstate_global->__pyx_tuple__105
#define __pyx_tuple__106 __pyx_mstate_global->__pyx_tuple__106
#define __pyx_tuple__111 __pyx_mstate_global->__pyx_tuple__111
#define __pyx_tuple__123 __pyx_mstate_global->__pyx_tuple__123
#define __pyx_tuple__124 __pyx_mstate_global->__pyx_tuple__124
#define __pyx_tuple__135 __pyx_mstate_global->__pyx_tuple__135
#define __pyx_tuple__136 __pyx_mstate_global->__pyx_tuple__136
#define __pyx_tuple__164 __pyx_mstate_global->__pyx_tuple__164
#define __pyx_tuple__165 __pyx_mstate_global->__pyx_tuple__165
#define __pyx_tuple__166 __pyx_mstate_global->__pyx_tuple__166
#define __pyx_tuple__167 __pyx_mstate_global->__pyx_tuple__167
#define __pyx_tuple__168 __pyx_mstate_global->__pyx_tuple__168
#define __pyx_tuple__169 __pyx_mstate_global->__pyx_tuple__169
#define __pyx_tuple__170 __pyx_mstate_global->__pyx_tuple__170
#define __pyx_tuple__171 __pyx_mstate_global->__pyx_tuple__171
#define __pyx_tuple__172 __pyx_mstate_global->__pyx_tuple__172
#define __pyx_tuple__173 __pyx_mstate_global->__pyx_tuple__173
#define __pyx_tuple__174 __pyx_mstate_global->__pyx_tuple__174
#define __pyx_tuple__175 __pyx_mstate_global->__pyx_tuple__175
#define __pyx_tuple__176 __pyx_mstate_global->__pyx_tuple__176
#define __pyx_tuple__177 __pyx_mstate_global->__pyx_tuple__177
#define __pyx_tuple__180 __pyx_mstate_global->__pyx_tuple__180
#define __pyx_tuple__182 __pyx_mstate_global->__pyx_tuple__182
#define __pyx_tuple__183 __pyx_mstate_global->__pyx_tuple__183
#define __pyx_tuple__197 __pyx_mstate_global->__pyx_tuple__197
#define __pyx_tuple__210 __pyx_mstate_global->__pyx_tuple__210
#define __pyx_tuple__219 __pyx_mstate_global->__pyx_tuple__219
#define __pyx_tuple__220 __pyx_mstate_global->__pyx_tuple__220
#define __pyx_tuple__221 __pyx_mstate_global->__pyx_tuple__221
#define __pyx_tuple__222 __pyx_mstate_global->__pyx_tuple__222
#define __pyx_tuple__223 __pyx_mstate_global->__pyx_tuple__223
#define __pyx_tuple__224 __pyx_mstate_global->__pyx_tuple__224
#define __pyx_tuple__227 __pyx_mstate_global->__pyx_tuple__227
#define __pyx_tuple__228 __pyx_mstate_global->__pyx_tuple__228
#define __pyx_tuple__232 __pyx_mstate_global->__pyx_tuple__232
#define __pyx_tuple__233 __pyx_mstate_global->__pyx_tuple__233
#define __pyx_tuple__234 __pyx_mstate_global->__pyx_tuple__234
#define __pyx_tuple__236 __pyx_mstate_global->__pyx_tuple__236
#define __pyx_tuple__238 __pyx_mstate_global->__pyx_tuple__238
#define __pyx_tuple__239 __pyx_mstate_global->__pyx_tuple__239
#define __pyx_tuple__242 __pyx_mstate_global->__pyx_tuple__242
#define __pyx_tuple__247 __pyx_mstate_global->__pyx_tuple__247
#define __pyx_tuple__249 __pyx_mstate_global->__pyx_tuple__249
#define __pyx_tuple__250 __pyx_mstate_global->__pyx_tuple__250
#define __pyx_tuple__253 __pyx_mstate_global->__pyx_tuple__253
#define __pyx_tuple__255 __pyx_mstate_global->__pyx_tuple__255
#define __pyx_tuple__256 __pyx_mstate_global->__pyx_tuple__256
#define __pyx_tuple__260 __pyx_mstate_global->__pyx_tuple__260
#define __pyx_tuple__262 __pyx_mstate_global->__pyx_tuple__262
#define __pyx_tuple__264 __pyx_mstate_global->__pyx_tuple__264
#define __pyx_tuple__266 __pyx_mstate_global->__pyx_tuple__266
#define __pyx_tuple__270 __pyx_mstate_global->__pyx_tuple__270
#define __pyx_tuple__275 __pyx_mstate_global->__pyx_tuple__275
#define __pyx_tuple__277 __pyx_mstate_global->__pyx_tuple__277
#define __pyx_tuple__279 __pyx_mstate_global->__pyx_tuple__279
#define __pyx_tuple__280 __pyx_mstate_global->__pyx_tuple__280
#define __pyx_tuple__281 __pyx_mstate_global->__pyx_tuple__281
#define __pyx_tuple__282 __pyx_mstate_global->__pyx_tuple__282
#define __pyx_tuple__283 __pyx_mstate_global->__pyx_tuple__283
#define __pyx_tuple__284 __pyx_mstate_global->__pyx_tuple__284
#define __pyx_tuple__285 __pyx_mstate_global->__pyx_tuple__285
#define __pyx_tuple__286 __pyx_mstate_global->__pyx_tuple__286
#define __pyx_tuple__287 __pyx_mstate_global->__pyx_tuple__287
#define __pyx_tuple__288 __pyx_mstate_global->__pyx_tuple__288
#define __pyx_tuple__289 __pyx_mstate_global->__pyx_tuple__289
#define __pyx_tuple__290 __pyx_mstate_global->__pyx_tuple__290
#define __pyx_tuple__291 __pyx_mstate_global->__pyx_tuple__291
#define __pyx_tuple__292 __pyx_mstate_global->__pyx_tuple__292
#define __pyx_tuple__293 __pyx_mstate_global->__pyx_tuple__293
#define __pyx_tuple__294 __pyx_mstate_global->__pyx_tuple__294
#define __pyx_tuple__295 __pyx_mstate_global->__pyx_tuple__295
#define __pyx_tuple__296 __pyx_mstate_global->__pyx_tuple__296
#define __pyx_tuple__297 __pyx_mstate_global->__pyx_tuple__297
#define __pyx_tuple__298 __pyx_mstate_global->__pyx_tuple__298
#define __pyx_tuple__299 __pyx_mstate_global->__pyx_tuple__299
#define __pyx_tuple__300 __pyx_mstate_global->__pyx_tuple__300
#define __pyx_tuple__301 __pyx_mstate_global->__pyx_tuple__301
#define __pyx_tuple__302 __pyx_mstate_global->__pyx_tuple__302
#define __pyx_tuple__303 __pyx_mstate_global->__pyx_tuple__303
#define __pyx_tuple__304 __pyx_mstate_global->__pyx_tuple__304
#define __pyx_tuple__305 __pyx_mstate_global->__pyx_tuple__305
#define __pyx_tuple__306 __pyx_mstate_global->__pyx_tuple__306
#define __pyx_tuple__307 __pyx_mstate_global->__pyx_tuple__307
#define __pyx_tuple__308 __pyx_mstate_global->__pyx_tuple__308
#define __pyx_tuple__309 __pyx_mstate_global->__pyx_tuple__309
#define __pyx_tuple__310 __pyx_mstate_global->__pyx_tuple__310
#define __pyx_tuple__311 __pyx_mstate_global->__pyx_tuple__311
#define __pyx_tuple__312 __pyx_mstate_global->__pyx_tuple__312
#define __pyx_tuple__313 __pyx_mstate_global->__pyx_tuple__313
#define __pyx_tuple__314 __pyx_mstate_global->__pyx_tuple__314
#define __pyx_tuple__315 __pyx_mstate_global->__pyx_tuple__315
#define __pyx_tuple__316 __pyx_mstate_global->__pyx_tuple__316
#define __pyx_tuple__317 __pyx_mstate_global->__pyx_tuple__317
#define __pyx_tuple__318 __pyx_mstate_global->__pyx_tuple__318
#define __pyx_tuple__319 __pyx_mstate_global->__pyx_tuple__319
#define __pyx_tuple__320 __pyx_mstate_global->__pyx_tuple__320
#define __pyx_tuple__321 __pyx_mstate_global->__pyx_tuple__321
#define __pyx_tuple__322 __pyx_mstate_global->__pyx_tuple__322
#define __pyx_tuple__324 __pyx_mstate_global->__pyx_tuple__324
#define __pyx_tuple__325 __pyx_mstate_global->__pyx_tuple__325
#define __pyx_tuple__326 __pyx_mstate_global->__pyx_tuple__326
#define __pyx_tuple__327 __pyx_mstate_global->__pyx_tuple__327
#define __pyx_tuple__328 __pyx_mstate_global->__pyx_tuple__328
#define __pyx_tuple__329 __pyx_mstate_global->__pyx_tuple__329
#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33
#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34
#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35
#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36
#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37
#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38
#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39
#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40
#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42
#define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44
#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45
#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46
#define __pyx_codeobj__49 __pyx_mstate_global->__pyx_codeobj__49
#define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50
#define __pyx_codeobj__54 __pyx_mstate_global->__pyx_codeobj__54
#define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55
#define __pyx_codeobj__56 __pyx_mstate_global->__pyx_codeobj__56
#define __pyx_codeobj__59 __pyx_mstate_global->__pyx_codeobj__59
#define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62
#define __pyx_codeobj__63 __pyx_mstate_global->__pyx_codeobj__63
#define __pyx_codeobj__64 __pyx_mstate_global->__pyx_codeobj__64
#define __pyx_codeobj__65 __pyx_mstate_global->__pyx_codeobj__65
#define __pyx_codeobj__66 __pyx_mstate_global->__pyx_codeobj__66
#define __pyx_codeobj__67 __pyx_mstate_global->__pyx_codeobj__67
#define __pyx_codeobj__68 __pyx_mstate_global->__pyx_codeobj__68
#define __pyx_codeobj__69 __pyx_mstate_global->__pyx_codeobj__69
#define __pyx_codeobj__70 __pyx_mstate_global->__pyx_codeobj__70
#define __pyx_codeobj__71 __pyx_mstate_global->__pyx_codeobj__71
#define __pyx_codeobj__72 __pyx_mstate_global->__pyx_codeobj__72
#define __pyx_codeobj__73 __pyx_mstate_global->__pyx_codeobj__73
#define __pyx_codeobj__74 __pyx_mstate_global->__pyx_codeobj__74
#define __pyx_codeobj__75 __pyx_mstate_global->__pyx_codeobj__75
#define __pyx_codeobj__78 __pyx_mstate_global->__pyx_codeobj__78
#define __pyx_codeobj__79 __pyx_mstate_global->__pyx_codeobj__79
#define __pyx_codeobj__80 __pyx_mstate_global->__pyx_codeobj__80
#define __pyx_codeobj__81 __pyx_mstate_global->__pyx_codeobj__81
#define __pyx_codeobj__82 __pyx_mstate_global->__pyx_codeobj__82
#define __pyx_codeobj__83 __pyx_mstate_global->__pyx_codeobj__83
#define __pyx_codeobj__84 __pyx_mstate_global->__pyx_codeobj__84
#define __pyx_codeobj__85 __pyx_mstate_global->__pyx_codeobj__85
#define __pyx_codeobj__86 __pyx_mstate_global->__pyx_codeobj__86
#define __pyx_codeobj__87 __pyx_mstate_global->__pyx_codeobj__87
#define __pyx_codeobj__89 __pyx_mstate_global->__pyx_codeobj__89
#define __pyx_codeobj__90 __pyx_mstate_global->__pyx_codeobj__90
#define __pyx_codeobj__92 __pyx_mstate_global->__pyx_codeobj__92
#define __pyx_codeobj__93 __pyx_mstate_global->__pyx_codeobj__93
#define __pyx_codeobj__94 __pyx_mstate_global->__pyx_codeobj__94
#define __pyx_codeobj__96 __pyx_mstate_global->__pyx_codeobj__96
#define __pyx_codeobj__97 __pyx_mstate_global->__pyx_codeobj__97
#define __pyx_codeobj__99 __pyx_mstate_global->__pyx_codeobj__99
#define __pyx_codeobj__101 __pyx_mstate_global->__pyx_codeobj__101
#define __pyx_codeobj__102 __pyx_mstate_global->__pyx_codeobj__102
#define __pyx_codeobj__104 __pyx_mstate_global->__pyx_codeobj__104
#define __pyx_codeobj__107 __pyx_mstate_global->__pyx_codeobj__107
#define __pyx_codeobj__108 __pyx_mstate_global->__pyx_codeobj__108
#define __pyx_codeobj__109 __pyx_mstate_global->__pyx_codeobj__109
#define __pyx_codeobj__110 __pyx_mstate_global->__pyx_codeobj__110
#define __pyx_codeobj__112 __pyx_mstate_global->__pyx_codeobj__112
#define __pyx_codeobj__113 __pyx_mstate_global->__pyx_codeobj__113
#define __pyx_codeobj__114 __pyx_mstate_global->__pyx_codeobj__114
#define __pyx_codeobj__115 __pyx_mstate_global->__pyx_codeobj__115
#define __pyx_codeobj__116 __pyx_mstate_global->__pyx_codeobj__116
#define __pyx_codeobj__117 __pyx_mstate_global->__pyx_codeobj__117
#define __pyx_codeobj__118 __pyx_mstate_global->__pyx_codeobj__118
#define __pyx_codeobj__119 __pyx_mstate_global->__pyx_codeobj__119
#define __pyx_codeobj__120 __pyx_mstate_global->__pyx_codeobj__120
#define __pyx_codeobj__121 __pyx_mstate_global->__pyx_codeobj__121
#define __pyx_codeobj__122 __pyx_mstate_global->__pyx_codeobj__122
#define __pyx_codeobj__125 __pyx_mstate_global->__pyx_codeobj__125
#define __pyx_codeobj__126 __pyx_mstate_global->__pyx_codeobj__126
#define __pyx_codeobj__127 __pyx_mstate_global->__pyx_codeobj__127
#define __pyx_codeobj__128 __pyx_mstate_global->__pyx_codeobj__128
#define __pyx_codeobj__129 __pyx_mstate_global->__pyx_codeobj__129
#define __pyx_codeobj__130 __pyx_mstate_global->__pyx_codeobj__130
#define __pyx_codeobj__131 __pyx_mstate_global->__pyx_codeobj__131
#define __pyx_codeobj__132 __pyx_mstate_global->__pyx_codeobj__132
#define __pyx_codeobj__133 __pyx_mstate_global->__pyx_codeobj__133
#define __pyx_codeobj__134 __pyx_mstate_global->__pyx_codeobj__134
#define __pyx_codeobj__137 __pyx_mstate_global->__pyx_codeobj__137
#define __pyx_codeobj__138 __pyx_mstate_global->__pyx_codeobj__138
#define __pyx_codeobj__139 __pyx_mstate_global->__pyx_codeobj__139
#define __pyx_codeobj__140 __pyx_mstate_global->__pyx_codeobj__140
#define __pyx_codeobj__141 __pyx_mstate_global->__pyx_codeobj__141
#define __pyx_codeobj__142 __pyx_mstate_global->__pyx_codeobj__142
#define __pyx_codeobj__143 __pyx_mstate_global->__pyx_codeobj__143
#define __pyx_codeobj__144 __pyx_mstate_global->__pyx_codeobj__144
#define __pyx_codeobj__145 __pyx_mstate_global->__pyx_codeobj__145
#define __pyx_codeobj__147 __pyx_mstate_global->__pyx_codeobj__147
#define __pyx_codeobj__148 __pyx_mstate_global->__pyx_codeobj__148
#define __pyx_codeobj__149 __pyx_mstate_global->__pyx_codeobj__149
#define __pyx_codeobj__150 __pyx_mstate_global->__pyx_codeobj__150
#define __pyx_codeobj__151 __pyx_mstate_global->__pyx_codeobj__151
#define __pyx_codeobj__152 __pyx_mstate_global->__pyx_codeobj__152
#define __pyx_codeobj__153 __pyx_mstate_global->__pyx_codeobj__153
#define __pyx_codeobj__154 __pyx_mstate_global->__pyx_codeobj__154
#define __pyx_codeobj__155 __pyx_mstate_global->__pyx_codeobj__155
#define __pyx_codeobj__156 __pyx_mstate_global->__pyx_codeobj__156
#define __pyx_codeobj__157 __pyx_mstate_global->__pyx_codeobj__157
#define __pyx_codeobj__159 __pyx_mstate_global->__pyx_codeobj__159
#define __pyx_codeobj__160 __pyx_mstate_global->__pyx_codeobj__160
#define __pyx_codeobj__161 __pyx_mstate_global->__pyx_codeobj__161
#define __pyx_codeobj__162 __pyx_mstate_global->__pyx_codeobj__162
#define __pyx_codeobj__163 __pyx_mstate_global->__pyx_codeobj__163
#define __pyx_codeobj__178 __pyx_mstate_global->__pyx_codeobj__178
#define __pyx_codeobj__179 __pyx_mstate_global->__pyx_codeobj__179
#define __pyx_codeobj__184 __pyx_mstate_global->__pyx_codeobj__184
#define __pyx_codeobj__185 __pyx_mstate_global->__pyx_codeobj__185
#define __pyx_codeobj__186 __pyx_mstate_global->__pyx_codeobj__186
#define __pyx_codeobj__187 __pyx_mstate_global->__pyx_codeobj__187
#define __pyx_codeobj__188 __pyx_mstate_global->__pyx_codeobj__188
#define __pyx_codeobj__189 __pyx_mstate_global->__pyx_codeobj__189
#define __pyx_codeobj__190 __pyx_mstate_global->__pyx_codeobj__190
#define __pyx_codeobj__191 __pyx_mstate_global->__pyx_codeobj__191
#define __pyx_codeobj__192 __pyx_mstate_global->__pyx_codeobj__192
#define __pyx_codeobj__194 __pyx_mstate_global->__pyx_codeobj__194
#define __pyx_codeobj__195 __pyx_mstate_global->__pyx_codeobj__195
#define __pyx_codeobj__196 __pyx_mstate_global->__pyx_codeobj__196
#define __pyx_codeobj__198 __pyx_mstate_global->__pyx_codeobj__198
#define __pyx_codeobj__199 __pyx_mstate_global->__pyx_codeobj__199
#define __pyx_codeobj__200 __pyx_mstate_global->__pyx_codeobj__200
#define __pyx_codeobj__201 __pyx_mstate_global->__pyx_codeobj__201
#define __pyx_codeobj__202 __pyx_mstate_global->__pyx_codeobj__202
#define __pyx_codeobj__203 __pyx_mstate_global->__pyx_codeobj__203
#define __pyx_codeobj__204 __pyx_mstate_global->__pyx_codeobj__204
#define __pyx_codeobj__205 __pyx_mstate_global->__pyx_codeobj__205
#define __pyx_codeobj__207 __pyx_mstate_global->__pyx_codeobj__207
#define __pyx_codeobj__208 __pyx_mstate_global->__pyx_codeobj__208
#define __pyx_codeobj__209 __pyx_mstate_global->__pyx_codeobj__209
#define __pyx_codeobj__211 __pyx_mstate_global->__pyx_codeobj__211
#define __pyx_codeobj__212 __pyx_mstate_global->__pyx_codeobj__212
#define __pyx_codeobj__213 __pyx_mstate_global->__pyx_codeobj__213
#define __pyx_codeobj__214 __pyx_mstate_global->__pyx_codeobj__214
#define __pyx_codeobj__215 __pyx_mstate_global->__pyx_codeobj__215
#define __pyx_codeobj__216 __pyx_mstate_global->__pyx_codeobj__216
#define __pyx_codeobj__217 __pyx_mstate_global->__pyx_codeobj__217
#define __pyx_codeobj__218 __pyx_mstate_global->__pyx_codeobj__218
#define __pyx_codeobj__225 __pyx_mstate_global->__pyx_codeobj__225
#define __pyx_codeobj__226 __pyx_mstate_global->__pyx_codeobj__226
#define __pyx_codeobj__229 __pyx_mstate_global->__pyx_codeobj__229
#define __pyx_codeobj__230 __pyx_mstate_global->__pyx_codeobj__230
#define __pyx_codeobj__231 __pyx_mstate_global->__pyx_codeobj__231
#define __pyx_codeobj__235 __pyx_mstate_global->__pyx_codeobj__235
#define __pyx_codeobj__237 __pyx_mstate_global->__pyx_codeobj__237
#define __pyx_codeobj__243 __pyx_mstate_global->__pyx_codeobj__243
#define __pyx_codeobj__244 __pyx_mstate_global->__pyx_codeobj__244
#define __pyx_codeobj__245 __pyx_mstate_global->__pyx_codeobj__245
#define __pyx_codeobj__246 __pyx_mstate_global->__pyx_codeobj__246
#define __pyx_codeobj__248 __pyx_mstate_global->__pyx_codeobj__248
#define __pyx_codeobj__251 __pyx_mstate_global->__pyx_codeobj__251
#define __pyx_codeobj__252 __pyx_mstate_global->__pyx_codeobj__252
#define __pyx_codeobj__254 __pyx_mstate_global->__pyx_codeobj__254
#define __pyx_codeobj__257 __pyx_mstate_global->__pyx_codeobj__257
#define __pyx_codeobj__258 __pyx_mstate_global->__pyx_codeobj__258
#define __pyx_codeobj__259 __pyx_mstate_global->__pyx_codeobj__259
#define __pyx_codeobj__261 __pyx_mstate_global->__pyx_codeobj__261
#define __pyx_codeobj__263 __pyx_mstate_global->__pyx_codeobj__263
#define __pyx_codeobj__265 __pyx_mstate_global->__pyx_codeobj__265
#define __pyx_codeobj__267 __pyx_mstate_global->__pyx_codeobj__267
#define __pyx_codeobj__268 __pyx_mstate_global->__pyx_codeobj__268
#define __pyx_codeobj__269 __pyx_mstate_global->__pyx_codeobj__269
#define __pyx_codeobj__271 __pyx_mstate_global->__pyx_codeobj__271
#define __pyx_codeobj__272 __pyx_mstate_global->__pyx_codeobj__272
#define __pyx_codeobj__273 __pyx_mstate_global->__pyx_codeobj__273
#define __pyx_codeobj__274 __pyx_mstate_global->__pyx_codeobj__274
#define __pyx_codeobj__276 __pyx_mstate_global->__pyx_codeobj__276
/* #### Code section: module_code ### */

/* "cpython/complex.pxd":19
 * 
 *         @property
 *         cdef inline double real(self) noexcept:             # <<<<<<<<<<<<<<
 *             return self.cval.real
 * 
 */

static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":20
 *         @property
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":19
 * 
 *         @property
 *         cdef inline double real(self) noexcept:             # <<<<<<<<<<<<<<
 *             return self.cval.real
 * 
 */

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

/* "cpython/complex.pxd":23
 * 
 *         @property
 *         cdef inline double imag(self) noexcept:             # <<<<<<<<<<<<<<
 *             return self.cval.imag
 * 
 */

static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":24
 *         @property
 *         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":23
 * 
 *         @property
 *         cdef inline double imag(self) noexcept:             # <<<<<<<<<<<<<<
 *             return self.cval.imag
 * 
 */

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

/* "cpython/contextvars.pxd":112
 * 
 * 
 * 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,
 */

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) {
  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", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":117
 *     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":118
 *     """
 *     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, 118, __pyx_L1_error)

  /* "cpython/contextvars.pxd":119
 *     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":121
 *     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":119
 *     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":124
 *     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":125
 *         # 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":126
 *         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":112
 * 
 * 
 * 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,
 */

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

/* "cpython/contextvars.pxd":129
 * 
 * 
 * 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.
 */

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) {
  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", 1);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":135
 *     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":136
 *     """
 *     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, 136, __pyx_L1_error)

  /* "cpython/contextvars.pxd":138
 *     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":139
 *     # 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":140
 *     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":129
 * 
 * 
 * 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.
 */

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

/* "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 = PyInt_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 = PyInt_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", 1);

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

  /* "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_TraceDeclarations
  __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_RefNannySetupContext("bcf_str_cache_get_charptr", 1);
  __Pyx_TraceCall("bcf_str_cache_get_charptr", __pyx_f[0], 163, 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);
    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;
  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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("comb", 1);
  __Pyx_TraceCall("comb", __pyx_f[0], 183, 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;
    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;
    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));
  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_PyInt_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_2 = __Pyx_PyInt_From_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_2)) __PYX_ERR(0, 205, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  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, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 205, __pyx_L1_error)
        }
        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_PyInt_AddObjC(__pyx_v_d, __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_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":209
 *         result  *= d
 *         result //= i
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_result); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error)
  __pyx_r = __pyx_t_6;
  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_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_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("bcf_geno_combinations", __pyx_f[0], 212, 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;
  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_AddTraceback("pysam.libcbcf.bcf_geno_combinations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("check_header_id", __pyx_f[0], 233, 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;
  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_AddTraceback("pysam.libcbcf.check_header_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("is_gt_fmt", __pyx_f[0], 237, 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);
  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_AddTraceback("pysam.libcbcf.is_gt_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_genotype_count", 1);
  __Pyx_TraceCall("bcf_genotype_count", __pyx_f[0], 241, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); 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_3 = (__pyx_v_ngt <= 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_gt_arr != 0));
  __pyx_t_1 = __pyx_t_3;
  __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;
    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_3 = (__pyx_v_ploidy < __pyx_v_max_ploidy);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_gt[0]) != bcf_int32_vector_end);
    __pyx_t_1 = __pyx_t_3;
    __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_4 = __pyx_f_5pysam_7libcbcf_bcf_geno_combinations(__pyx_v_ploidy, __pyx_v_rec->n_allele); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L1_error)
  __pyx_r = __pyx_t_4;
  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_AddTraceback("pysam.libcbcf.bcf_genotype_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_char_array_to_tuple_locals_genex, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 271, 0, __PYX_ERR(0, 271, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple, __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_TraceCall("char_array_to_tuple", __pyx_f[0], 267, 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;
    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_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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || 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)
 * 
 */
        }
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_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_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_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_bcf_array_to_object_locals_genex, __pyx_n_s_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_TraceDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  struct __pyx_opt_args_5pysam_9libcutils_decode_bytes __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 302, 0, __PYX_ERR(0, 302, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_umethod_PyBytes_Type_split, __pyx_cur_scope->__pyx_genexpr_arg_0, __pyx_kp_b__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__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);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__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);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 302, __pyx_L1_error)
        }
        break;
      }
      __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_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_v); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_PyInt_From_int32_t(bcf_str_missing); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_v, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {
      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_9.__pyx_n = 1;
      __pyx_t_9.encoding = __pyx_kp_u_utf_8;
      __pyx_t_8 = __pyx_f_5pysam_9libcutils_decode_bytes(((PyObject*)__pyx_cur_scope->__pyx_v_v), &__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_t_8;
      __pyx_t_8 = 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_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __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_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;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    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);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __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;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_array_to_object", 1);
  __Pyx_TraceCall("bcf_array_to_object", __pyx_f[0], 277, 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_empty_tuple);
      __pyx_v_value = __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_PyInt_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_PyInt_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_PyInt_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_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); 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_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_value, __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_tuple__4, __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_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_9 == 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_PyInt_From_long, 0, 0, 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;
  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_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_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_bcf_object_to_array_locals_genex, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 360, 0, __PYX_ERR(0, 360, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 360, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 360, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 360, __pyx_L1_error)
        }
        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_PyInt_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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_object_to_array", 0);
  __Pyx_TraceCall("bcf_object_to_array", __pyx_f[0], 348, 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_kp_b__2, __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, PyInt_FromSsize_t, 0, 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_PyInt_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, PyInt_FromSsize_t, 0, 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_PyInt_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, PyInt_FromSsize_t, 0, 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_PyInt_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, PyInt_FromSsize_t, 0, 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_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int32_t __pyx_t_7;
  uint32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_empty_array", 1);
  __Pyx_TraceCall("bcf_empty_array", __pyx_f[0], 402, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); 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_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error)
    __pyx_v_datac = ((char *)__pyx_t_3);

    /* "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_4 = __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_v_i = __pyx_t_6;

      /* "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_7 = bcf_str_missing;
      } else {
        __pyx_t_7 = bcf_str_vector_end;
      }
      (__pyx_v_datac[__pyx_v_i]) = __pyx_t_7;
    }

    /* "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_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 418, __pyx_L1_error)
    __pyx_v_data32 = ((int32_t *)((char *)__pyx_t_3));

    /* "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_4 = __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_v_i = __pyx_t_6;

      /* "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_7 = bcf_int32_missing;
      } else {
        __pyx_t_7 = bcf_int32_vector_end;
      }
      (__pyx_v_data32[__pyx_v_i]) = __pyx_t_7;
    }

    /* "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_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error)
    __pyx_v_dataf = ((float *)((char *)__pyx_t_3));

    /* "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_4 = __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_v_i = __pyx_t_6;

      /* "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_8 = bcf_float_missing;
      } else {
        __pyx_t_8 = bcf_float_vector_end;
      }
      bcf_float_set((__pyx_v_dataf + __pyx_v_i), __pyx_t_8);
    }

    /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); 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;
  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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_7;
  size_t __pyx_t_8;
  size_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int32_t __pyx_t_12;
  uint32_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_copy_expand_array", 1);
  __Pyx_TraceCall("bcf_copy_expand_array", __pyx_f[0], 432, 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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Cannot_copy_arrays_with_src_valu, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_src_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_dst_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_8 = __pyx_v_dst_values;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = __pyx_v_src_values; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "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_11 = (__pyx_v_src_type == BCF_BT_INT8);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_11;
  __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_8 = __pyx_v_src_values;
    __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":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_8 = __pyx_v_dst_values;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = __pyx_v_src_values; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "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_12 = bcf_int32_missing;
      } else {
        __pyx_t_12 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_12;
    }

    /* "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_11 = (__pyx_v_src_type == BCF_BT_INT16);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_11;
  __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_8 = __pyx_v_src_values;
    __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":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_8 = __pyx_v_dst_values;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = __pyx_v_src_values; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "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_12 = bcf_int32_missing;
      } else {
        __pyx_t_12 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_12;
    }

    /* "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_11 = (__pyx_v_src_type == BCF_BT_INT32);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_11;
  __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_8 = __pyx_v_src_values;
    __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":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_8 = __pyx_v_dst_values;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = __pyx_v_src_values; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "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_12 = bcf_int32_missing;
      } else {
        __pyx_t_12 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_12;
    }

    /* "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_11 = (__pyx_v_src_type == BCF_BT_FLOAT);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_dst_type == BCF_BT_FLOAT);
  __pyx_t_1 = __pyx_t_11;
  __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_8 = __pyx_v_src_values;
    __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":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_8 = __pyx_v_dst_values;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = __pyx_v_src_values; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "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_13 = bcf_float_missing;
      } else {
        __pyx_t_13 = bcf_float_vector_end;
      }
      bcf_float_set((__pyx_v_dst_dataf + __pyx_v_i), __pyx_t_13);
    }

    /* "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_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __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, 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);
  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_AddTraceback("pysam.libcbcf.bcf_copy_expand_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  uint32_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_get_value_count", 1);
  __Pyx_TraceCall("bcf_get_value_count", __pyx_f[0], 501, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_5 = (!__pyx_t_1);
  if (unlikely(__pyx_t_5)) {

    /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); 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_5 = __pyx_t_1;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_id); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_6 != 0);
  __pyx_t_5 = __pyx_t_1;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_5) {

    /* "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_5 = (__pyx_v_length == BCF_VL_FIXED);
  if (__pyx_t_5) {

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

      /* "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_5 = (__pyx_v_length == BCF_VL_R);
  if (__pyx_t_5) {

    /* "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_7 = __pyx_v_r->n_allele;
    (__pyx_v_count[0]) = __pyx_t_7;

    /* "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_5 = (__pyx_v_length == BCF_VL_A);
  if (__pyx_t_5) {

    /* "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_5 = (__pyx_v_length == BCF_VL_G);
  if (__pyx_t_5) {

    /* "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_6 = __pyx_f_5pysam_7libcbcf_bcf_genotype_count(__pyx_v_hdr, __pyx_v_r, __pyx_v_sample); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 527, __pyx_L1_error)
    (__pyx_v_count[0]) = __pyx_t_6;

    /* "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_5 = (__pyx_v_length == BCF_VL_VAR);
  if (likely(__pyx_t_5)) {

    /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.bcf_get_value_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_info_get_value", 1);
  __Pyx_TraceCall("bcf_info_get_value", __pyx_f[0], 534, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_empty_tuple);
      __pyx_v_value = __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_PyInt_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_PyInt_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_PyInt_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 = __Pyx_PyInt_From_int32_t(__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_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_2); 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_t_2 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 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 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __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, 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_5 = (!(__pyx_v_scalar != 0));
    if (__pyx_t_5) {
    } else {
      __pyx_t_1 = __pyx_t_5;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_empty_tuple, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_5;
    __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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value)) __PYX_ERR(0, 568, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 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_2 = __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_2)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 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;
  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_4);
  __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_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_bcf_check_values_locals_genexpr, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 614, 0, __PYX_ERR(0, 614, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 614, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 614, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 614, __pyx_L1_error)
        }
        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_kp_b__12);
      __pyx_t_4 = __pyx_kp_b__12;
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_check_values", 1);
  __Pyx_TraceCall("bcf_check_values", __pyx_f[0], 575, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = PyList_Check(__pyx_v_value); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {
    __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)) __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_3 = (__pyx_v_ht_type == BCF_HT_FLAG);
  if (__pyx_t_3) {

    /* "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_3 = __pyx_t_1;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_record->header->ptr, __pyx_v_id); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 591, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_1;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_3) {

    /* "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_6 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 595, __pyx_L1_error)
  __pyx_v_given = __pyx_t_6;

  /* "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_3 = __pyx_t_1;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_value_count[0]) != __pyx_v_given);
  __pyx_t_3 = __pyx_t_1;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_3) {

    /* "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_3 = ((__pyx_v_scalar[0]) != 0);
    if (unlikely(__pyx_t_3)) {

      /* "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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_value_expected_to_be_scalar_give, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_given); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      __pyx_t_9 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_9 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __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, 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_values_expected_to_be_tuple_give, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_value_count[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_given); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = NULL;
      __pyx_t_9 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_9 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_7, __pyx_t_8};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __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, 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_3 = (__pyx_v_ht_type == BCF_HT_REAL);
  if (__pyx_t_3) {

    /* "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_6 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_6 = -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_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 603, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 603, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 603, __pyx_L1_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 603, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 603, __pyx_L1_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_11(__pyx_t_2);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 603, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 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_3 = __pyx_t_1;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_12 = PyFloat_Check(__pyx_v_v); 
      if (!__pyx_t_12) {
      } else {
        __pyx_t_1 = __pyx_t_12;
        goto __pyx_L19_bool_binop_done;
      }
      __pyx_t_12 = PyInt_Check(__pyx_v_v); 
      __pyx_t_1 = __pyx_t_12;
      __pyx_L19_bool_binop_done:;
      __pyx_t_3 = __pyx_t_1;
      __pyx_L17_bool_binop_done:;
      __pyx_t_1 = (!__pyx_t_3);
      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 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __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, 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_6 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_6 = -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_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 607, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 607, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L1_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 607, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L1_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_11(__pyx_t_2);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 607, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 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_3 = (__pyx_v_v == Py_None);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_12 = PyFloat_Check(__pyx_v_v); 
      if (!__pyx_t_12) {
      } else {
        __pyx_t_3 = __pyx_t_12;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_12 = PyInt_Check(__pyx_v_v); 
      __pyx_t_3 = __pyx_t_12;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_v_v, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_1 = __pyx_t_3;
      __pyx_L25_bool_binop_done:;
      __pyx_t_3 = (!__pyx_t_1);
      if (unlikely(__pyx_t_3)) {

        /* "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_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_Raise(__pyx_t_8, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(0, 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_6 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_6 = -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_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 610, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_11(__pyx_t_2);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 610, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
      __pyx_t_8 = 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_3 = __pyx_t_1;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyInt_From_int32_t(bcf_int32_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __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_7 = __Pyx_PyInt_From_int32_t(INT32_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_3 = __pyx_t_1;
      __pyx_L34_bool_binop_done:;
      __pyx_t_1 = (!__pyx_t_3);
      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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); 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_kp_b__2, __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_PyInt_From_long, 0, 0, 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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 616, __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_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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 616, __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_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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 616, __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_L38_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_4, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_4, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_3;
    __pyx_L38_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_1;
    if (unlikely(__pyx_t_3)) {

      /* "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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); 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_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); 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_6 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 622, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_6 <= 1);
  if (__pyx_t_1) {
  } else {
    __pyx_t_3 = __pyx_t_1;
    goto __pyx_L44_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_hl_type == BCF_HL_INFO);
  __pyx_t_3 = __pyx_t_1;
  __pyx_L44_bool_binop_done:;
  if (__pyx_t_3) {

    /* "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_6 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_6 > __pyx_v_bt_len);
  if (__pyx_t_3) {

    /* "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_3 = (__pyx_v_bt_type == BCF_BT_INT8);
  if (__pyx_t_3) {

    /* "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_6 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_6 = -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_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 627, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_11(__pyx_t_4);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 627, __pyx_L1_error)
          }
          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_3 = __pyx_t_1;
        goto __pyx_L49_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyInt_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_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_v, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_8)) {
        __Pyx_DECREF(__pyx_t_8);
        __pyx_t_7 = __Pyx_PyInt_From_int8_t(INT8_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_v_v, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = (!__pyx_t_1);
      __pyx_t_3 = __pyx_t_12;
      __pyx_L49_bool_binop_done:;
      if (__pyx_t_3) {

        /* "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_3 = (__pyx_v_bt_type == BCF_BT_INT16);
  if (__pyx_t_3) {

    /* "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_6 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_6 = -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_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 632, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 632, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 632, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_11(__pyx_t_4);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 632, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
      __pyx_t_8 = 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_12 = (__pyx_v_v != Py_None);
      if (__pyx_t_12) {
      } else {
        __pyx_t_3 = __pyx_t_12;
        goto __pyx_L55_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyInt_From_int32_t(bcf_int16_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __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_7 = __Pyx_PyInt_From_int16_t(INT16_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_v, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = (!__pyx_t_12);
      __pyx_t_3 = __pyx_t_1;
      __pyx_L55_bool_binop_done:;
      if (__pyx_t_3) {

        /* "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;
  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_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf1_t *__pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char *__pyx_t_10;
  uint32_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_encode_alleles", 0);
  __Pyx_TraceCall("bcf_encode_alleles", __pyx_f[0], 640, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_3;

  /* "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_4 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_4;

  /* "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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_5 = PyList_Check(__pyx_v_values); 
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = PyTuple_Check(__pyx_v_values); 
  __pyx_t_1 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  __pyx_t_5 = (!__pyx_t_1);
  if (__pyx_t_5) {

    /* "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)) __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_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -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_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 656, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 656, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 656, __pyx_L1_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 656, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 656, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 656, __pyx_L1_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 656, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 656, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8);
    __pyx_t_8 = 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_5 = (__pyx_v_value == Py_None);
    if (__pyx_t_5) {

      /* "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_8 = __Pyx_PyInt_From_uint32_t(bcf_gt_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_5 = __pyx_t_1;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_1 = PyBytes_Check(__pyx_v_value); 
    __pyx_t_5 = __pyx_t_1;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_5) {

      /* "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_8 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_bvalue, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 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_10 = __Pyx_PyBytes_AsWritableString(__pyx_v_bvalue); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error)
      __pyx_v_s = __pyx_t_10;

      /* "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_4 = __pyx_v_r->n_allele;
      __pyx_t_11 = __pyx_t_4;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

        /* "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_5 = (strcmp((__pyx_v_r->d.allele[__pyx_v_i]), __pyx_v_s) != 0);
        if (__pyx_t_5) {

          /* "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_8 = __Pyx_PyInt_From_uint32_t(bcf_gt_unphased(__pyx_v_i)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_Raise(__pyx_t_8, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(0, 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_12 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L1_error)
      __pyx_v_i = __pyx_t_12;

      /* "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_5 = (0 <= __pyx_v_i);
      if (__pyx_t_5) {
        __pyx_t_5 = (__pyx_v_i < __pyx_v_nalleles);
      }
      __pyx_t_1 = (!__pyx_t_5);
      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_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 671, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_Raise(__pyx_t_8, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(0, 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_8 = __Pyx_PyInt_From_uint32_t(bcf_gt_unphased(__pyx_v_i)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 672, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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;
  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_8);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  char const *__pyx_t_12;
  Py_ssize_t __pyx_t_13;
  long __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  char *__pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_info_set_value", 1);
  __Pyx_TraceCall("bcf_info_set_value", __pyx_f[0], 677, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "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_6 = __pyx_v_info->key;
    __pyx_v_info_id = __pyx_t_6;

    /* "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_6 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_6 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L1_error)
    __pyx_v_info_id = __pyx_t_6;
  }
  __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_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_INFO, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_10 = (!__pyx_t_1);
  if (unlikely(__pyx_t_10)) {

    /* "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_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 701, __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, 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_10 = (__pyx_v_info != 0);
  if (__pyx_t_10) {
    __pyx_t_6 = __pyx_v_info->type;
  } else {
    __pyx_t_6 = -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_10 = (__pyx_v_info != 0);
  if (__pyx_t_10) {
    __pyx_t_11 = __pyx_v_info->len;
  } else {
    __pyx_t_11 = -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_7 = __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_6, __pyx_t_11, (&__pyx_v_value_count), (&__pyx_v_scalar), (&__pyx_v_realloc)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_values = __pyx_t_7;
  __pyx_t_7 = 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_10 = (__pyx_v_info_type == BCF_HT_FLAG);
  if (__pyx_t_10) {

    /* "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_12 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error)
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_12, NULL, (!(!__pyx_t_10)), __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_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 712, __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, 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_13 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 716, __pyx_L1_error)
  __pyx_v_value_count = __pyx_t_13;

  /* "pysam/libcbcf.pyx":745
 *         return
 * 
 *     alloc_len = max(1, value_count)             # <<<<<<<<<<<<<<
 *     if info and info.len > alloc_len:
 *         alloc_len = info.len
 */
  __pyx_t_11 = __pyx_v_value_count;
  __pyx_t_14 = 1;
  __pyx_t_1 = (__pyx_t_11 > __pyx_t_14);
  if (__pyx_t_1) {
    __pyx_t_15 = __pyx_t_11;
  } else {
    __pyx_t_15 = __pyx_t_14;
  }
  __pyx_v_alloc_len = __pyx_t_15;

  /* "pysam/libcbcf.pyx":746
 * 
 *     alloc_len = max(1, value_count)
 *     if info and info.len > alloc_len:             # <<<<<<<<<<<<<<
 *         alloc_len = info.len
 * 
 */
  __pyx_t_10 = (__pyx_v_info != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_1 = __pyx_t_10;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_10 = (__pyx_v_info->len > __pyx_v_alloc_len);
  __pyx_t_1 = __pyx_t_10;
  __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_6 = __pyx_v_info->len;
    __pyx_v_alloc_len = __pyx_t_6;

    /* "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_7 = __pyx_f_5pysam_7libcbcf_bcf_empty_array(__pyx_v_info_type, __pyx_v_alloc_len, __pyx_v_vlen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_new_values = __pyx_t_7;
  __pyx_t_7 = 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_16 = __Pyx_PyObject_AsWritableString(__pyx_v_new_values); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L1_error)
  __pyx_v_valp = ((char *)__pyx_t_16);

  /* "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_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 759, __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, 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_7 = __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_7)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_12 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
  __pyx_t_1 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_12, __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_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 764, __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, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_info_del_value", 1);
  __Pyx_TraceCall("bcf_info_del_value", __pyx_f[0], 767, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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_3 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "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_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); 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_empty_tuple);
    __pyx_v_null_value = __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_tuple__4, __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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_format_get_value", 1);
  __Pyx_TraceCall("bcf_format_get_value", __pyx_f[0], 797, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 810, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "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_6 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_FORMAT, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_10 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt->id); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_10 != 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_7 = __pyx_f_5pysam_7libcbcf_bcf_format_get_allele_indices(__pyx_v_sample); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    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_7 = ((PyObject *)__pyx_v_sample->record);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_7), BCF_HL_FMT, __pyx_v_fmt->id, (&__pyx_v_count), (&__pyx_v_scalar), __pyx_v_sample->index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_6 = (__pyx_v_fmt->p != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_fmt->n != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_fmt->size != 0);
  __pyx_t_1 = __pyx_t_6;
  __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_2 = __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_2)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  long __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  uint32_t __pyx_t_16;
  char *__pyx_t_17;
  Py_ssize_t __pyx_t_18;
  char const *__pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_format_set_value", 0);
  __Pyx_TraceCall("bcf_format_set_value", __pyx_f[0], 830, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_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_n_s_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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "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_6 = __pyx_v_fmt->id;
    __pyx_v_fmt_id = __pyx_t_6;

    /* "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_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error)
    __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_7);

    /* "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_8 = (__pyx_v_k == kh_end(__pyx_v_d));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_8 = (((kh_val(__pyx_v_d, __pyx_v_k).info[BCF_HL_FMT]) & 0xF) == 0xF);
    __pyx_t_1 = __pyx_t_8;
    __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_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_format, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_6 = kh_val(__pyx_v_d, __pyx_v_k).id;
    __pyx_v_fmt_id = __pyx_t_6;
  }
  __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_8 = (!__pyx_t_1);
  if (unlikely(__pyx_t_8)) {

    /* "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_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 864, __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, 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_8 = (__pyx_v_fmt_type == BCF_HT_FLAG);
  if (unlikely(__pyx_t_8)) {

    /* "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_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 869, __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, 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_6 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt_id); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_6 != 0);
  if (__pyx_t_8) {

    /* "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_9 = ((PyObject *)__pyx_v_sample->record);
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_encode_alleles(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_9), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
    __pyx_t_2 = 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_2 = ((PyObject *)__pyx_v_sample->record);
  __Pyx_INCREF(__pyx_t_2);

  /* "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_8 = (__pyx_v_fmt != 0);
  if (__pyx_t_8) {
    __pyx_t_6 = __pyx_v_fmt->type;
  } else {
    __pyx_t_6 = -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_8 = (__pyx_v_fmt != 0);
  if (__pyx_t_8) {
    __pyx_t_12 = __pyx_v_fmt->n;
  } else {
    __pyx_t_12 = -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_9 = __pyx_f_5pysam_7libcbcf_bcf_check_values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_2), __pyx_v_value, __pyx_v_sample->index, BCF_HL_FMT, __pyx_v_fmt_type, __pyx_v_fmt_id, __pyx_t_6, __pyx_t_12, (&__pyx_v_value_count), (&__pyx_v_scalar), (&__pyx_v_realloc)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_values = __pyx_t_9;
  __pyx_t_9 = 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_13 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 882, __pyx_L1_error)
  __pyx_v_value_count = __pyx_t_13;

  /* "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_8 = __pyx_t_1;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_1 = (!(__pyx_v_realloc != 0));
  __pyx_t_8 = __pyx_t_1;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_8) {

    /* "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_9 = __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_9)) __PYX_ERR(0, 887, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_12 = __pyx_v_value_count;
  __pyx_t_14 = 1;
  __pyx_t_8 = (__pyx_t_12 > __pyx_t_14);
  if (__pyx_t_8) {
    __pyx_t_15 = __pyx_t_12;
  } else {
    __pyx_t_15 = __pyx_t_14;
  }
  __pyx_v_alloc_len = __pyx_t_15;

  /* "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_8 = __pyx_t_1;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_fmt->n > __pyx_v_alloc_len);
  __pyx_t_8 = __pyx_t_1;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_8) {

    /* "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_6 = __pyx_v_fmt->n;
    __pyx_v_alloc_len = __pyx_t_6;

    /* "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_16 = __pyx_v_r->n_sample;
  __pyx_v_nsamples = __pyx_t_16;

  /* "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_9 = __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_9)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_new_values = __pyx_t_9;
  __pyx_t_9 = 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_17 = __Pyx_PyObject_AsWritableString(__pyx_v_new_values); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 896, __pyx_L1_error)
  __pyx_v_new_values_p = ((char *)__pyx_t_17);

  /* "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_8 = (__pyx_v_fmt_type == BCF_HT_INT);
  if (__pyx_t_8) {

    /* "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_8 = (__pyx_v_fmt_type == BCF_HT_REAL);
  if (__pyx_t_8) {

    /* "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_8 = (__pyx_v_fmt_type == BCF_HT_STR);
  if (likely(__pyx_t_8)) {

    /* "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_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 908, __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, 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_8 = __pyx_t_1;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_nsamples > 1);
  __pyx_t_8 = __pyx_t_1;
  __pyx_L21_bool_binop_done:;
  if (__pyx_t_8) {

    /* "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_15 = __pyx_v_nsamples;
    __pyx_t_12 = __pyx_t_15;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_12; __pyx_t_18+=1) {
      __pyx_v_i = __pyx_t_18;

      /* "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_9 = __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_9)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_9 = __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_9)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_19 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
  __pyx_t_8 = (bcf_update_format(__pyx_v_hdr, __pyx_v_r, __pyx_t_19, __pyx_v_new_values_p, ((int)(__pyx_v_nsamples * __pyx_v_alloc_len)), __pyx_v_fmt_type) < 0);
  if (unlikely(__pyx_t_8)) {

    /* "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_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 919, __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, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  char const *__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_RefNannySetupContext("bcf_format_del_value", 1);
  __Pyx_TraceCall("bcf_format_del_value", __pyx_f[0], 922, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 935, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "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_6 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); 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_7 = __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_7)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "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_empty_tuple);
    __pyx_v_null_value = __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_7 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_value_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_null_value = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L8:;

  /* "pysam/libcbcf.pyx":949
 *         null_value = (None,)*value_count
 * 
 *     bcf_format_set_value(sample, bkey, null_value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_format_set_value(__pyx_v_sample, __pyx_v_bkey, __pyx_v_null_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  bcf_fmt_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_format_get_allele_indices", 1);
  __Pyx_TraceCall("bcf_format_get_allele_indices", __pyx_f[0], 952, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_5 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_5;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_6 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_7 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_7;

  /* "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_8 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 967, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_8;

  /* "pysam/libcbcf.pyx":969
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
 */
  __pyx_t_6 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_5 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_5;

  /* "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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __Pyx_PyInt_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 987, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __Pyx_PyInt_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __Pyx_PyInt_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1007, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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;
  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_11);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  bcf_fmt_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_format_get_alleles", 1);
  __Pyx_TraceCall("bcf_format_get_alleles", __pyx_f[0], 1012, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_5 = __pyx_v_r->n_sample;
  __pyx_v_nsamples = __pyx_t_5;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_5 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_5;

  /* "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_6 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_sample->index >= __pyx_v_nsamples);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_7 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_7;

  /* "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_8 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1031
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
 */
  __pyx_t_6 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1052, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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_8 = __pyx_v_fmt0->n;
    __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":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_11 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1059, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
        __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_12 == ((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;
  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_11);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  bcf_fmt_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_sample_get_phased", 1);
  __Pyx_TraceCall("bcf_sample_get_phased", __pyx_f[0], 1063, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_5 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_5;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_6 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_6;
  __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;
    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_7 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_7;

  /* "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_8 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1078, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1080
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_6 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_6;
  __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;
    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_8 = __pyx_v_fmt0->n;
    __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":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_6 = (__pyx_v_i != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L16_bool_binop_done;
      }
      __pyx_t_6 = (!(bcf_gt_is_phased((__pyx_v_data8[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_6;
      __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;
        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_8 = __pyx_v_fmt0->n;
    __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":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_6 = (__pyx_v_i != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L21_bool_binop_done;
      }
      __pyx_t_6 = (!(bcf_gt_is_phased((__pyx_v_data16[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_6;
      __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;
        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_8 = __pyx_v_fmt0->n;
    __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":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_6 = (__pyx_v_i != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_6 = (!(bcf_gt_is_phased((__pyx_v_data32[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_6;
      __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;
        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;
  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_AddTraceback("pysam.libcbcf.bcf_sample_get_phased", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  bcf1_t *__pyx_t_4;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  bcf_fmt_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int32_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_sample_set_phased", 1);
  __Pyx_TraceCall("bcf_sample_set_phased", __pyx_f[0], 1126, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); 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_3 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_4;

  /* "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_5 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_5;

  /* "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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); 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_6 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_7 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_7;

  /* "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_8 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_8 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_8;

  /* "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_6 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_6;
  __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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); 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_8 = __pyx_v_fmt0->n;
    __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":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_8 = __pyx_v_fmt0->n;
    __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":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_8 = __pyx_v_fmt0->n;
    __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":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_PyInt_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_11 = PyNumber_And(__pyx_t_2, __pyx_int_4294967294); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __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_12 = PyNumber_Or(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_13 = __Pyx_PyInt_As_int32_t(__pyx_t_12); if (unlikely((__pyx_t_13 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        (__pyx_v_data32[__pyx_v_i]) = __pyx_t_13;

        /* "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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pysam.libcbcf.bcf_sample_set_phased", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_sync_end", 1);
  __Pyx_TraceCall("bcf_sync_end", __pyx_f[0], 1179, 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_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_n_s_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_n_s_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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); 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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_record->header), __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_add); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_number, __pyx_int_1) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_type, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_description, __pyx_kp_u_Stop_position_of_the_interval) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__28, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = __Pyx_PyInt_From_int32_t((__pyx_v_record->ptr->pos + __pyx_v_record->ptr->rlen)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __pyx_f_5pysam_7libcbcf_bcf_info_set_value(__pyx_v_record, __pyx_n_b_END, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.libcbcf.bcf_sync_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  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_TraceCall("has_symbolic_allele", __pyx_f[0], 1209, 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;
      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;
  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_AddTraceback("pysam.libcbcf.has_symbolic_allele", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_t *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bcf_header_remove_hrec", 1);
  __Pyx_TraceCall("bcf_header_remove_hrec", __pyx_f[0], 1226, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); 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_3 = __pyx_v_header->ptr;
  __pyx_v_hdr = __pyx_t_3;

  /* "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_4 = (__pyx_v_i < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_i >= __pyx_v_hdr->nhrec);
  __pyx_t_1 = __pyx_t_4;
  __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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.bcf_header_remove_hrec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1251, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1254, 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_PyInt_From_int, 0, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1262, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.key.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1268, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantHeaderRecord___get___loca, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 1281, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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)) __PYX_ERR(0, 1281, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 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"""
 */

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_TraceDeclarations
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__, __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_TraceCall("__get__", __pyx_f[0], 1274, 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_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    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;
  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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  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_TraceCall("__len__", __pyx_f[0], 1285, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  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_TraceCall("__bool__", __pyx_f[0], 1289, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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__, "get 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1293, 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;
        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_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__32, NULL); 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_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_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderRecord___iter, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1304, 0, __PYX_ERR(0, 1304, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = NULL;
    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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __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_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1313, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__33)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 1313, 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;
      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;

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

      /* "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_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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1320, 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;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1323, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":1324
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__34)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1328, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues, __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, __pyx_codeobj__35, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantHeaderRecord_itervalues, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__35)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1332, 0, __PYX_ERR(0, 1332, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = NULL;
    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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __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_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems, __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, __pyx_codeobj__36, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantHeaderRecord_iteritems, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__36)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1342, 0, __PYX_ERR(0, 1342, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = NULL;
    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)) __PYX_ERR(0, 1350, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __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_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_24keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__37)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 1352, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_26items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__38)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 1356, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_28values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__39)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 1360, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.update([E, ]**F) -> None.\n\n        Update D from dict/iterable E and F.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_30update = {"update", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_items,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1364, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 1364, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__40)
  __Pyx_RefNannySetupContext("update", 1);
  __Pyx_TraceCall("update", __pyx_f[0], 1364, 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_n_s_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_n_s_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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__41);
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1376, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1376, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 1376, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__42)
  __Pyx_RefNannySetupContext("pop", 1);
  __Pyx_TraceCall("pop", __pyx_f[0], 1376, 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;
      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;

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

      /* "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_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_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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__str__", 1);
  __Pyx_TraceCall("__str__", __pyx_f[0], 1391, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); 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;
  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_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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "remove", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__44)
  __Pyx_RefNannySetupContext("remove", 1);
  __Pyx_TraceCall("remove", __pyx_f[0], 1411, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 48, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__45)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__46)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantHeaderRecord", 1);
  __Pyx_TraceCall("makeVariantHeaderRecord", __pyx_f[0], 1422, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_ptype_5pysam_7libcbcf_VariantHeaderRecord), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1438, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__len__", __pyx_f[0], 1441, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1444, 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);
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1447, 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_PyInt_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_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__48, NULL); 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_5 = ((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_5)) __PYX_ERR(0, 1451, __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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderRecords___iter, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1453, 0, __PYX_ERR(0, 1453, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 53, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__49)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__50)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantHeaderRecords", 1);
  __Pyx_TraceCall("makeVariantHeaderRecords", __pyx_f[0], 1461, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_ptype_5pysam_7libcbcf_VariantHeaderRecords), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1472, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantMetadata.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1475, 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;
  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_AddTraceback("pysam.libcbcf.VariantMetadata.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1482, 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_PyInt_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;
  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_AddTraceback("pysam.libcbcf.VariantMetadata.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1487, 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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); 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_PyInt_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;
    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_kp_u__52);
    __pyx_r = __pyx_kp_u__52;
    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_PyInt_From_int, 0, 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;
    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_AddTraceback("pysam.libcbcf.VariantMetadata.number.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1506, 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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); 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_5 = 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_5, int, 1, __Pyx_PyInt_From_int, 0, 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;
  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_AddTraceback("pysam.libcbcf.VariantMetadata.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1517, 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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_record); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_n_u_Description};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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_PyObject_GetAttrStr(__pyx_v_descr, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__53};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __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;
  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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1525, 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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); 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_5 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), __pyx_v_hrec)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1534, __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;
  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_AddTraceback("pysam.libcbcf.VariantMetadata.record.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "remove_header", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__54)
  __Pyx_RefNannySetupContext("remove_header", 1);
  __Pyx_TraceCall("remove_header", __pyx_f[0], 1536, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 70, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__55)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_PyInt_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_PyInt_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))) __PYX_ERR(4, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_215036767);
    __Pyx_GIVEREF(__pyx_int_215036767);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_215036767)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_215036767);
    __Pyx_GIVEREF(__pyx_int_215036767);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_215036767)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__56)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantMetadata", 1);
  __Pyx_TraceCall("makeVariantMetadata", __pyx_f[0], 1542, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__57, NULL); 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); 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_ptype_5pysam_7libcbcf_VariantMetadata), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1562, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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)\nAdd a new filter, info or format record");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_3add = {"add", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_id,&__pyx_n_s_number,&__pyx_n_s_type,&__pyx_n_s_description,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 1); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 2); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_description)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, 3); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(0, 1565, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned 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(__pyx_codeobj__59)
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceCall("add", __pyx_f[0], 1565, 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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Header_already_exists_for_id, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1572, __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, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1574, __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, 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __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_n_u_ID);
    __Pyx_GIVEREF(__pyx_n_u_ID);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_ID)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_u_Description);
    __Pyx_GIVEREF(__pyx_n_u_Description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_Description)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_description);
    __Pyx_GIVEREF(__pyx_v_description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_description)) __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_2);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_type_specified, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      __pyx_t_5 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_type};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1579, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1579, __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, 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_kp_u__52);
      __Pyx_DECREF_SET(__pyx_v_number, __pyx_kp_u__52);

      /* "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_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_id};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_n_u_ID);
    __Pyx_GIVEREF(__pyx_n_u_ID);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_ID)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":1584
 * 
 *             items = [('ID', unquoted_str(id)),
 *                      ('Number', unquoted_str(number)),             # <<<<<<<<<<<<<<
 *                      ('Type', unquoted_str(type)),
 *                      ('Description', description)]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_number};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __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_n_u_Number);
    __Pyx_GIVEREF(__pyx_n_u_Number);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Number)) __PYX_ERR(0, 1584, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":1585
 *             items = [('ID', unquoted_str(id)),
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),             # <<<<<<<<<<<<<<
 *                      ('Description', description)]
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_type};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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_n_u_Type);
    __Pyx_GIVEREF(__pyx_n_u_Type);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_Type)) __PYX_ERR(0, 1585, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":1586
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),
 *                      ('Description', description)]             # <<<<<<<<<<<<<<
 * 
 *         items += kwargs.items()
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_u_Description);
    __Pyx_GIVEREF(__pyx_n_u_Description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_Description)) __PYX_ERR(0, 1586, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_description);
    __Pyx_GIVEREF(__pyx_v_description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_description)) __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_7 = PyList_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_2)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_6)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_3)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_3 = 0;
    __pyx_v_items = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L4:;

  /* "pysam/libcbcf.pyx":1588
 *                      ('Description', description)]
 * 
 *         items += kwargs.items()             # <<<<<<<<<<<<<<
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_items, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_items, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1589
 * 
 *         items += kwargs.items()
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->header), __pyx_n_s_add_meta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  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_7 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_7libcbcf_METADATA_TYPES, __pyx_v_self->type, int32_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7)) __PYX_ERR(0, 1589, __pyx_L1_error);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_items, __pyx_v_items) < 0) __PYX_ERR(0, 1589, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__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_2); __pyx_t_2 = 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);
  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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  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_TraceCall("__len__", __pyx_f[0], 1591, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  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_TraceCall("__bool__", __pyx_f[0], 1602, 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;
      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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1613, 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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_key, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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_6 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_6), __pyx_v_self->type, kh_val(__pyx_v_d, __pyx_v_k).id)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  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_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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1625, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove_header") < 0)) __PYX_ERR(0, 1625, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__62)
  __Pyx_RefNannySetupContext("remove_header", 1);
  __Pyx_TraceCall("remove_header", __pyx_f[0], 1625, 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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_key, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 1635, __pyx_L1_error)
  bcf_hdr_remove(__pyx_v_hdr, __pyx_v_self->type, __pyx_t_9);

  /* "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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear_header", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__63)
  __Pyx_RefNannySetupContext("clear_header", 1);
  __Pyx_TraceCall("clear_header", __pyx_f[0], 1638, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.clear_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderMetadata___iter, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1643, 0, __PYX_ERR(0, 1643, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __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_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1653, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1653, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1653, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__64)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 1653, 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;
      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;

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

      /* "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_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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1660, 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;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1663, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":1664
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__65)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1668, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues, __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, __pyx_codeobj__66, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantHeaderMetadata_itervalues, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__66)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1672, 0, __PYX_ERR(0, 1672, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1674, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1674, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1674, __pyx_L1_error)
        }
        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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems, __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, __pyx_codeobj__67, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantHeaderMetadata_iteritems, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__67)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1677, 0, __PYX_ERR(0, 1677, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1679, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1679, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1679, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1679, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1679, __pyx_L1_error)
        }
        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)) __PYX_ERR(0, 1680, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_30keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__68)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 1682, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_32items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__69)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 1686, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_34values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__70)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 1690, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 76, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__71)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_PyInt_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))) __PYX_ERR(4, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_135711299);
    __Pyx_GIVEREF(__pyx_int_135711299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_135711299)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_135711299);
    __Pyx_GIVEREF(__pyx_int_135711299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_135711299)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__72)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantHeaderMetadata", 1);
  __Pyx_TraceCall("makeVariantHeaderMetadata", __pyx_f[0], 1700, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_ptype_5pysam_7libcbcf_VariantHeaderMetadata), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1713, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantContig.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1716, 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;
  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_AddTraceback("pysam.libcbcf.VariantContig.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1722, 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_PyInt_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;
  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_AddTraceback("pysam.libcbcf.VariantContig.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1727, 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_PyInt_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;
  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_AddTraceback("pysam.libcbcf.VariantContig.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1734, 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;
  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_AddTraceback("pysam.libcbcf.VariantContig.header_record.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "remove_header", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__73)
  __Pyx_RefNannySetupContext("remove_header", 1);
  __Pyx_TraceCall("remove_header", __pyx_f[0], 1741, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 65, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__74)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_PyInt_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))) __PYX_ERR(4, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_39264352);
    __Pyx_GIVEREF(__pyx_int_39264352);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_39264352)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_39264352);
    __Pyx_GIVEREF(__pyx_int_39264352);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_39264352)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__75)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantContig", 1);
  __Pyx_TraceCall("makeVariantContig", __pyx_f[0], 1747, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__76, NULL); 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_ptype_5pysam_7libcbcf_VariantContig), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1763, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__len__", __pyx_f[0], 1766, 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]);
  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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1771, 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);
  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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1776, 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 = PyInt_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_PyInt_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_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__77, NULL); 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_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantContig(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5), __pyx_v_index)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    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_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_bkey = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 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_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1788, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_7);

  /* "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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_contig, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_5 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantContig(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5), __pyx_v_id)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  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_8);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1797, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove_header") < 0)) __PYX_ERR(0, 1797, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  Py_ssize_t __pyx_t_6;
  char const *__pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__78)
  __Pyx_RefNannySetupContext("remove_header", 0);
  __Pyx_TraceCall("remove_header", __pyx_f[0], 1797, 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 = PyInt_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_PyInt_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_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__77, NULL); 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_n_s_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = ((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_t_6]).key;
    __pyx_v_ckey = __pyx_t_7;

    /* "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_8 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 1812, __pyx_L1_error)
    __pyx_t_2 = (kh_get_vdict(__pyx_v_d, __pyx_t_8) == 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_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_contig, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_11 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1813, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_12 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 1814, __pyx_L1_error)
    __pyx_v_ckey = __pyx_t_12;
  }
  __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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear_header", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__79)
  __Pyx_RefNannySetupContext("clear_header", 1);
  __Pyx_TraceCall("clear_header", __pyx_f[0], 1818, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.clear_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderContigs___iter, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1823, 0, __PYX_ERR(0, 1823, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 1833, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__80)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 1833, 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;
      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;

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

      /* "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_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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1840, 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;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1843, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":1844
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__81)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1848, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues, __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, __pyx_codeobj__82, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantHeaderContigs_itervalues, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__82)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1852, 0, __PYX_ERR(0, 1852, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1854, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1854, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1854, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1854, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1854, __pyx_L1_error)
        }
        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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems, __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, __pyx_codeobj__83, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantHeaderContigs_iteritems, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__83)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1857, 0, __PYX_ERR(0, 1857, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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 = __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_MACROS
          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 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1859, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          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 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1859, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1859, __pyx_L1_error)
        }
        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)) __PYX_ERR(0, 1860, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_28keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__84)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 1862, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderContigs.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_30items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__85)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 1866, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_32values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__86)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 1870, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nAdd a new contig record");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_34add = {"add", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_id,&__pyx_n_s_length,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1879, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_length);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1879, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(0, 1879, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__87)
  __Pyx_RefNannySetupContext("add", 1);
  __Pyx_TraceCall("add", __pyx_f[0], 1879, 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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Header_already_exists_for_contig, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_ID);
  __Pyx_GIVEREF(__pyx_n_u_ID);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_ID)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_v_items = __pyx_t_3;
  __pyx_t_3 = 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_length};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_u_length);
    __Pyx_GIVEREF(__pyx_n_u_length);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_length)) __PYX_ERR(0, 1886, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 1886, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_items, __pyx_t_2); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_DECREF(__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()
 */
  }

  /* "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_2 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_items, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_items, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1888
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()
 *         self.header.add_meta('contig', items=items)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->header), __pyx_n_s_add_meta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_items, __pyx_v_items) < 0) __PYX_ERR(0, 1888, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__88, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 57, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__89)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__90)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantHeaderContigs", 1);
  __Pyx_TraceCall("makeVariantHeaderContigs", __pyx_f[0], 1891, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_ptype_5pysam_7libcbcf_VariantHeaderContigs), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1903, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); 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_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__len__", __pyx_f[0], 1906, 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);
  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_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1909, 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);
  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_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1912, 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_PyInt_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_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__91, NULL); 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;
  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_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderSamples___iter, __pyx_n_s_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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1922, 0, __PYX_ERR(0, 1922, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_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);

  /* "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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1929, 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));
  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_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 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)\nAdd a new sample");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_14add = {"add", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1942, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(0, 1942, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__92)
  __Pyx_RefNannySetupContext("add", 1);
  __Pyx_TraceCall("add", __pyx_f[0], 1942, 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->header), __pyx_n_s_add_sample); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 61, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__93)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_31479882)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__94)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("makeVariantHeaderSamples", 1);
  __Pyx_TraceCall("makeVariantHeaderSamples", __pyx_f[0], 1947, 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); 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_ptype_5pysam_7libcbcf_VariantHeaderSamples), __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;
  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_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_TraceReturn(__pyx_r, 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_MACROS
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1964, 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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_MACROS
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) 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_TraceDeclarations
  __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("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1968, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__95, NULL); 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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1973, 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 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantHeader.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1978, 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);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1978
 *             self.ptr = NULL
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.ptr != NULL
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__96)
  __Pyx_RefNannySetupContext("copy", 1);
  __Pyx_TraceCall("copy", __pyx_f[0], 1981, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_header,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1984, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "merge") < 0)) __PYX_ERR(0, 1984, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__97)
  __Pyx_RefNannySetupContext("merge", 1);
  __Pyx_TraceCall("merge", __pyx_f[0], 1984, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1989, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1994, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1999, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.records.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2004, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.contigs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2009, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.filters.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2014, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2019, 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;
  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_AddTraceback("pysam.libcbcf.VariantHeader.formats.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2024, 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_n_s_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 = __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_MACROS
            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 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2035, __pyx_L5_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_MACROS
            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 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2035, __pyx_L5_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2035, __pyx_L5_error)
          }
          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_6 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_record, __pyx_n_s_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2036, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_upper); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2036, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __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_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;
  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_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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  unsigned int __pyx_t_7;
  char *__pyx_t_8;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_subset_samples", 0);
  __Pyx_TraceCall("_subset_samples", __pyx_f[0], 2039, 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_n_s_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":2048
 *             # FIXME: add specialized exception with payload
 *             raise ValueError(
 *                 'missing {:d} requested samples'.format(             # <<<<<<<<<<<<<<
 *                     len(missing_samples)))
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_missing_d_requested_samples, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "pysam/libcbcf.pyx":2049
 *             raise ValueError(
 *                 'missing {:d} requested samples'.format(
 *                     len(missing_samples)))             # <<<<<<<<<<<<<<
 * 
 *         keep_samples = force_bytes(','.join(keep_samples))
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_missing_samples); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2049, __pyx_L1_error)
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2048, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "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 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1 = PyUnicode_Join(__pyx_kp_u__2, __pyx_v_keep_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_keep_samples, __pyx_t_2);
  __pyx_t_2 = 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_9 = __Pyx_PyObject_AsWritableString(__pyx_v_keep_samples); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2052, __pyx_L1_error)
    __pyx_t_8 = ((char *)__pyx_t_9);
  } else {
    __pyx_t_8 = NULL;
  }
  __pyx_v_keep = __pyx_t_8;

  /* "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_2 = __Pyx_PyInt_From_int(bcf_hdr_set_samples(__pyx_v_self->ptr, __pyx_v_keep, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 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_PyInt_BoolNeObjC(__pyx_v_ret, __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":2057
 *         if ret != 0:
 *             raise ValueError(
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_bcf_hdr_set_samples_failed_ret, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_ret};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2057, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "pysam/libcbcf.pyx":2056
 * 
 *         if ret != 0:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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("__str__", 1);
  __Pyx_TraceCall("__str__", __pyx_f[0], 2059, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__98, NULL); 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;
  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_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_TraceReturn(__pyx_r, 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)\nCreate a new empty VariantRecord.\n\n        Arguments are currently experimental.  Use with caution and expect\n        changes in upcoming releases.\n\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_15new_record = {"new_record", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_alleles,&__pyx_n_s_id,&__pyx_n_s_qual,&__pyx_n_s_filter,&__pyx_n_s_info,&__pyx_n_s_samples,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((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.
 */
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_alleles);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id);
          if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_qual);
          if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filter);
          if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_info);
          if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_samples);
          if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "new_record") < 0)) __PYX_ERR(0, 2076, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__99)
  __Pyx_RefNannySetupContext("new_record", 1);
  __Pyx_TraceCall("new_record", __pyx_f[0], 2076, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__100, NULL); 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_n_s_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_n_s_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_n_s_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_n_s_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_n_s_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_n_s_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_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_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -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_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2105, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_5)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2105, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2105, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_5(__pyx_t_1);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2105, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_6);
        __pyx_t_6 = 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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_n_s_filter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_add); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_9 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_9 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_f};
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2106, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_n_s_filter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_add); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_9 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_9 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_filter};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_n_s_info); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_info};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_n_s_samples); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_kwargs};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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_int_0);
    __pyx_t_1 = __pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_v_samples)) || PyTuple_CheckExact(__pyx_v_samples)) {
      __pyx_t_6 = __pyx_v_samples; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_samples); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2117, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_5(__pyx_t_6);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2117, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "pysam/libcbcf.pyx":2118
 *         if samples:
 *             for i, sample in enumerate(samples):
 *                 rec.samples[i].update(sample)             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_n_s_samples); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      __pyx_t_9 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_9 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_sample};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2118, __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":2117
 * 
 *         if samples:
 *             for i, sample in enumerate(samples):             # <<<<<<<<<<<<<<
 *                 rec.samples[i].update(sample)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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);
  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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(__pyx_r, 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)\nAdd an existing :class:`VariantHeaderRecord` to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_17add_record = {"add_record", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_record,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2122, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_record") < 0)) __PYX_ERR(0, 2122, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__101)
  __Pyx_RefNannySetupContext("add_record", 1);
  __Pyx_TraceCall("add_record", __pyx_f[0], 2122, 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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)\nAdd a metadata line to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_19add_line = {"add_line", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_line,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_line)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2133, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_line") < 0)) __PYX_ERR(0, 2133, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__102)
  __Pyx_RefNannySetupContext("add_line", 1);
  __Pyx_TraceCall("add_line", __pyx_f[0], 2133, 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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__103, NULL); 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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_TraceReturn(__pyx_r, 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)\nAdd metadata to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_21add_meta = {"add_meta", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,&__pyx_n_s_items,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2142, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2142, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2142, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_meta") < 0)) __PYX_ERR(0, 2142, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  PyObject *__pyx_t_7 = NULL;
  char const *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_t_16;
  char const *__pyx_t_17;
  Py_ssize_t __pyx_t_18;
  char const *__pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__104)
  __Pyx_RefNannySetupContext("add_meta", 0);
  __Pyx_TraceCall("add_meta", __pyx_f[0], 2142, 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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__105, NULL); 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_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*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_8 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L4_error)
      __pyx_v_hrec->key = strdup(__pyx_t_8);

      /* "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_8 = __Pyx_PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2155, __pyx_L4_error)
        __pyx_v_hrec->value = strdup(__pyx_t_8);
        __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_9 = 0;
          __pyx_t_10 = NULL;
        } else {
          __pyx_t_9 = -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_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2157, __pyx_L4_error)
        }
        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_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
                #endif
                if (__pyx_t_9 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
              #else
              __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2157, __pyx_L4_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
                #endif
                if (__pyx_t_9 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
              #else
              __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2157, __pyx_L4_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            }
          } else {
            __pyx_t_11 = __pyx_t_10(__pyx_t_4);
            if (unlikely(!__pyx_t_11)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 2157, __pyx_L4_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_11);
          }
          if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
            PyObject* sequence = __pyx_t_11;
            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_12 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            #else
            __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_13);
            #endif
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_14 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
            index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_12);
            index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L13_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_13);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 2157, __pyx_L4_error)
            __pyx_t_15 = NULL;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            goto __pyx_L14_unpacking_done;
            __pyx_L13_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_t_15 = 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_12);
          __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_13);
          __pyx_t_13 = 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_11, __pyx_n_s_unquoted_str); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2158, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_11); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2158, __pyx_L4_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_2 = (!__pyx_t_3);
          if (__pyx_t_2) {
          } else {
            __pyx_t_16 = __pyx_t_2;
            goto __pyx_L15_bool_binop_done;
          }
          __Pyx_INCREF(__pyx_v_key);
          __pyx_t_11 = __pyx_v_key;
          __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __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_11, __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_11, __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_11); __pyx_t_11 = 0;
          __pyx_t_3 = __pyx_t_2;
          __pyx_t_16 = __pyx_t_3;
          __pyx_L15_bool_binop_done:;
          __pyx_v_quoted = __pyx_t_16;

          /* "pysam/libcbcf.pyx":2160
 *                     quoted = not isinstance(value, unquoted_str) and key not in ("ID", "Number", "Type")
 * 
 *                     key = force_bytes(key)             # <<<<<<<<<<<<<<
 *                     bcf_hrec_add_key(hrec, key, <int>len(key))
 * 
 */
          __pyx_t_11 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2160, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "pysam/libcbcf.pyx":2161
 * 
 *                     key = force_bytes(key)
 *                     bcf_hrec_add_key(hrec, key, <int>len(key))             # <<<<<<<<<<<<<<
 * 
 *                     value = force_bytes(str(value))
 */
          __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L4_error)
          __pyx_t_18 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2161, __pyx_L4_error)
          bcf_hrec_add_key(__pyx_v_hrec, __pyx_t_17, ((int)__pyx_t_18));

          /* "pysam/libcbcf.pyx":2163
 *                     bcf_hrec_add_key(hrec, key, <int>len(key))
 * 
 *                     value = force_bytes(str(value))             # <<<<<<<<<<<<<<
 *                     bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted)
 *         except:
 */
          __pyx_t_11 = __Pyx_PyObject_Unicode(__pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2163, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_13 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_t_11, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2163, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_13);
          __pyx_t_13 = 0;

          /* "pysam/libcbcf.pyx":2164
 * 
 *                     value = force_bytes(str(value))
 *                     bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted)             # <<<<<<<<<<<<<<
 *         except:
 *             bcf_hrec_destroy(hrec)
 */
          __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_v_value); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 2164, __pyx_L4_error)
          __pyx_t_18 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2164, __pyx_L4_error)
          bcf_hrec_set_val(__pyx_v_hrec, (__pyx_v_hrec->nkeys - 1), __pyx_t_19, ((int)__pyx_t_18), __pyx_v_quoted);

          /* "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_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":2165
 *                     value = force_bytes(str(value))
 *                     bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted)
 *         except:             # <<<<<<<<<<<<<<
 *             bcf_hrec_destroy(hrec)
 *             raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_meta", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_13, &__pyx_t_11) < 0) __PYX_ERR(0, 2165, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);

      /* "pysam/libcbcf.pyx":2166
 *                     bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted)
 *         except:
 *             bcf_hrec_destroy(hrec)             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
      bcf_hrec_destroy(__pyx_v_hrec);

      /* "pysam/libcbcf.pyx":2167
 *         except:
 *             bcf_hrec_destroy(hrec)
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         bcf_hdr_add_hrec(self.ptr, hrec)
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_13, __pyx_t_11);
      __pyx_t_4 = 0; __pyx_t_13 = 0; __pyx_t_11 = 0; 
      __PYX_ERR(0, 2167, __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_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "pysam/libcbcf.pyx":2169
 *             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":2171
 *         bcf_hdr_add_hrec(self.ptr, hrec)
 * 
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 *     cdef _add_sample(self, name):
 */
  __pyx_t_11 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2173
 *         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_TraceDeclarations
  __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;
  unsigned int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_add_sample", 1);
  __Pyx_TraceCall("_add_sample", __pyx_f[0], 2173, 0, __PYX_ERR(0, 2173, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2174
 * 
 *     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, 2174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2175
 *     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, 2175, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2175, __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":2176
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Duplicated_sample_name, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2176, __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, 2176, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2175
 *     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":2173
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2178
 *             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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_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_RefNannySetupContext("_hdr_sync", 1);
  __Pyx_TraceCall("_hdr_sync", __pyx_f[0], 2178, 0, __PYX_ERR(0, 2178, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2179
 * 
 *     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":2180
 *     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":2181
 *         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":2182
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:
 *                 raise MemoryError('unable to reallocate VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def add_sample(self, name):
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__106, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2182, __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, 2182, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2181
 *         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
 *     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":2178
 *             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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader._hdr_sync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2184
 *                 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)\nAdd a new sample to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_23add_sample = {"add_sample", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2184, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_sample") < 0)) __PYX_ERR(0, 2184, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 2184, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__107)
  __Pyx_RefNannySetupContext("add_sample", 1);
  __Pyx_TraceCall("add_sample", __pyx_f[0], 2184, 0, __PYX_ERR(0, 2184, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2186
 *     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, 2186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2187
 *         """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, 2187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2184
 *                 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2189
 *         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)\nAdd several new samples to this header.\n        This function takes multiple arguments, each of which may\n        be either a sample name or an iterable returning sample names\n        (e.g., a list of sample names).\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_25add_samples = {"add_samples", (PyCFunction)(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_MACROS
  __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);
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_samples", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__108)
  __Pyx_RefNannySetupContext("add_samples", 1);
  __Pyx_TraceCall("add_samples", __pyx_f[0], 2189, 0, __PYX_ERR(0, 2189, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2195
 *         (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_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2195, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2195, __pyx_L1_error)
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":2196
 *         """
 *         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":2197
 *         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, 2197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":2196
 *         """
 *         for arg in args:
 *             if isinstance(arg, str):             # <<<<<<<<<<<<<<
 *                 self._add_sample(arg)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":2199
 *                 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, 2199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2199, __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_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2199, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 2199, __pyx_L1_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2199, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2199, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 2199, __pyx_L1_error)
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2199, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_6(__pyx_t_3);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2199, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "pysam/libcbcf.pyx":2200
 *             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, 2200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "pysam/libcbcf.pyx":2199
 *                 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":2195
 *         (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":2201
 *                 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, 2201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2189
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__109)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantHeader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__110)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantHeader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2204
 * 
 * 
 * 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_TraceDeclarations
  __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("makeVariantHeader", 1);
  __Pyx_TraceCall("makeVariantHeader", __pyx_f[0], 2204, 0, __PYX_ERR(0, 2204, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2205
 * 
 * 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":2206
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):
 *     if not hdr:
 *         raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2206, __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, 2206, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2205
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):
 *     if not hdr:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantHeader')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2208
 *         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_ptype_5pysam_7libcbcf_VariantHeader), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2208, __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":2209
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader)
 *     header.ptr = hdr             # <<<<<<<<<<<<<<
 * 
 *     return header
 */
  __pyx_v_header->ptr = __pyx_v_hdr;

  /* "pysam/libcbcf.pyx":2211
 *     header.ptr = hdr
 * 
 *     return header             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __pyx_r = __pyx_v_header;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2204
 * 
 * 
 * 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2214
 * 
 * 
 * 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_TraceDeclarations
  __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_RefNannySetupContext("bcf_header_get_info_id", 0);
  __Pyx_TraceCall("bcf_header_get_info_id", __pyx_f[0], 2214, 0, __PYX_ERR(0, 2214, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2219
 *     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":2220
 * 
 *     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, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":2219
 *     cdef int info_id
 * 
 *     if isinstance(key, str):             # <<<<<<<<<<<<<<
 *         key = force_bytes(key)
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2222
 *         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":2223
 * 
 *     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, 2223, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_3);

  /* "pysam/libcbcf.pyx":2225
 *     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":2226
 * 
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2225
 *     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":2228
 *         return -1
 * 
 *     return kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = kh_val(__pyx_v_d, __pyx_v_k).id;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2214
 * 
 * 
 * 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_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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2239
 *     """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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 2239, 0, __PYX_ERR(0, 2239, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2240
 *        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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2240, __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, 2240, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2239
 *     """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_AddTraceback("pysam.libcbcf.VariantRecordFilter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2242
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__len__", __pyx_f[0], 2242, 0, __PYX_ERR(0, 2242, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2243
 * 
 *     def __len__(self):
 *         return self.record.ptr.d.n_flt             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->record->ptr->d.n_flt;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2242
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFilter.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2245
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 2245, 0, __PYX_ERR(0, 2245, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2246
 * 
 *     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);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2245
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFilter.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2248
 *         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_TraceDeclarations
  __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;
  char const *__pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  unsigned int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 2248, 0, __PYX_ERR(0, 2248, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2249
 * 
 *     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":2250
 *     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":2252
 *         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":2254
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2255
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 * 
 *             if index < 0 or index >= n:
 */
    __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2255, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":2257
 *             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":2258
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2258, __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, 2258, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2257
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
 */
    }

    /* "pysam/libcbcf.pyx":2260
 *                 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":2254
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
 */
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2262
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
 */
  /*else*/ {
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_kp_u__52, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2262, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2263
 *         else:
 *             if key == '.':
 *                 key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *             bkey = force_bytes(key)
 */
      __Pyx_INCREF(__pyx_n_u_PASS);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_n_u_PASS);

      /* "pysam/libcbcf.pyx":2262
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
 */
    }

    /* "pysam/libcbcf.pyx":2265
 *                 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, 2265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2266
 * 
 *             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, 2266, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2266, __pyx_L1_error)
    __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2268
 *             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, 2268, __pyx_L1_error)
    __pyx_t_8 = (!__pyx_t_5);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L9_bool_binop_done;
    }
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2268, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2268, __pyx_L1_error)
    __pyx_t_8 = (!(bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_9) != 0));
    __pyx_t_4 = __pyx_t_8;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2269
 * 
 *             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_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_filter, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      __pyx_t_12 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_12 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(0, 2269, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2268
 *             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":2271
 *                 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_10 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_10);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_10), BCF_HL_FLT, __pyx_v_id)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2248
 *         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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2273
 *         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)\nAdd a new filter");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_9add = {"add", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2273, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(0, 2273, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2273, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__112)
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceCall("add", __pyx_f[0], 2273, 0, __PYX_ERR(0, 2273, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2275
 *     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":2276
 *         """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":2279
 *         cdef int id
 * 
 *         if key == '.':             # <<<<<<<<<<<<<<
 *             key = 'PASS'
 * 
 */
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_kp_u__52, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2279, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2280
 * 
 *         if key == '.':
 *             key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
 */
    __Pyx_INCREF(__pyx_n_u_PASS);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_n_u_PASS);

    /* "pysam/libcbcf.pyx":2279
 *         cdef int id
 * 
 *         if key == '.':             # <<<<<<<<<<<<<<
 *             key = 'PASS'
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2282
 *             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, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2283
 * 
 *         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, 2283, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2283, __pyx_L1_error)
  __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_5);

  /* "pysam/libcbcf.pyx":2285
 *         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, 2285, __pyx_L1_error)
  __pyx_t_6 = (!__pyx_t_3);
  if (unlikely(__pyx_t_6)) {

    /* "pysam/libcbcf.pyx":2286
 * 
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_filter, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 2286, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2285
 *         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":2288
 *             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":2273
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2290
 *         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_TraceDeclarations
  __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;
  char const *__pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  unsigned int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_TraceCall("__delitem__", __pyx_f[0], 2290, 0, __PYX_ERR(0, 2290, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2291
 * 
 *     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":2292
 *     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":2294
 *         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":2296
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2297
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 * 
 *             if index < 0 or index >= n:
 */
    __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2297, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":2299
 *             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":2300
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2300, __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, 2300, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2299
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
 */
    }

    /* "pysam/libcbcf.pyx":2302
 *                 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":2296
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
 */
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2304
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
 */
  /*else*/ {
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_kp_u__52, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2304, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2305
 *         else:
 *             if key == '.':
 *                 key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *             bkey = force_bytes(key)
 */
      __Pyx_INCREF(__pyx_n_u_PASS);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_n_u_PASS);

      /* "pysam/libcbcf.pyx":2304
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
 */
    }

    /* "pysam/libcbcf.pyx":2307
 *                 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, 2307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2308
 * 
 *             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, 2308, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2308, __pyx_L1_error)
    __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2310
 *             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, 2310, __pyx_L1_error)
    __pyx_t_8 = (!__pyx_t_5);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L9_bool_binop_done;
    }
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2310, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2310, __pyx_L1_error)
    __pyx_t_8 = (!(bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_9) != 0));
    __pyx_t_4 = __pyx_t_8;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2311
 * 
 *             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_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_filter, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2311, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      __pyx_t_12 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_12 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2311, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(0, 2311, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2310
 *             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":2313
 *                 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":2290
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2315
 *         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)\nClear all filters");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_13clear = {"clear", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__113)
  __Pyx_RefNannySetupContext("clear", 1);
  __Pyx_TraceCall("clear", __pyx_f[0], 2315, 0, __PYX_ERR(0, 2315, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2317
 *     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":2318
 *         """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":2319
 *         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":2315
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2321
 *         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_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__, __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, 2321, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordFilter___iter, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2321, __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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2321, 0, __PYX_ERR(0, 2321, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2321, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2322
 * 
 *     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":2323
 *     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":2326
 *         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":2327
 * 
 *         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, 2327, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2327, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysam/libcbcf.pyx":2321
 *         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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2329
 *             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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2329, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2329, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 2329, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2329, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__114)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 2329, 0, __PYX_ERR(0, 2329, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2331
 *     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":2332
 *         """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, 2332, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2331
 *     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;

    /* "pysam/libcbcf.pyx":2333
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2333, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":2334
 *             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_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":2331
 *     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":2329
 *             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_AddTraceback("pysam.libcbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2336
 *             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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 2336, 0, __PYX_ERR(0, 2336, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2337
 * 
 *     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":2338
 *     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":2339
 *         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, 2339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2340
 *         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, 2340, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2340, __pyx_L1_error)
  __pyx_r = (bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_4) == 1);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2336
 *             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_AddTraceback("pysam.libcbcf.VariantRecordFilter.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2342
 *         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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__115)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 2342, 0, __PYX_ERR(0, 2342, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2344
 *     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, 2344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2342
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFilter.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2346
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_24itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues, __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, 2346, __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, __pyx_codeobj__116, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordFilter_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2346, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__116)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 2346, 0, __PYX_ERR(0, 2346, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2346, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2348
 *     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, 2348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2348, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2348, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2348, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2348, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2348, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2348, __pyx_L1_error)
        }
        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":2349
 *         """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, 2349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2349, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2348
 *     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);

  /* "pysam/libcbcf.pyx":2346
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":2351
 *             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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_27iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems, __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, 2351, __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, __pyx_codeobj__117, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordFilter_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2351, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__117)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 2351, 0, __PYX_ERR(0, 2351, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2351, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2353
 *     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, 2353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2353, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2353, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2353, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2353, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2353, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2353, __pyx_L1_error)
        }
        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":2354
 *         """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, 2354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2354, __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)) __PYX_ERR(0, 2354, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 2354, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2354, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2353
 *     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);

  /* "pysam/libcbcf.pyx":2351
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2356
 *             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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_30keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__118)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 2356, 0, __PYX_ERR(0, 2356, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2358
 *     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, 2358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2356
 *             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_AddTraceback("pysam.libcbcf.VariantRecordFilter.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2360
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_32items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__119)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 2360, 0, __PYX_ERR(0, 2360, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2362
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2360
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2364
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_34values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__120)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 2364, 0, __PYX_ERR(0, 2364, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2366
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2364
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2368
 *         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, 2368, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, 0, "other", 0))) __PYX_ERR(0, 2368, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __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_RefNannySetupContext("__richcmp__", 1);
  __Pyx_TraceCall("__richcmp__", __pyx_f[0], 2368, 0, __PYX_ERR(0, 2368, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2369
 * 
 *     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":2370
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2369
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2372
 *             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":2373
 * 
 *         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":2375
 *         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, 2375, __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, 2375, __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, 2375, __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, 2375, __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":2377
 *         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":2378
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
 */
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2377
 *         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":2380
 *             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, 2380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2368
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFilter.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__121)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__122)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2388
 * 
 * 
 * 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_TraceDeclarations
  __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("makeVariantRecordFilter", 1);
  __Pyx_TraceCall("makeVariantRecordFilter", __pyx_f[0], 2388, 0, __PYX_ERR(0, 2388, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2389
 * 
 * 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, 2389, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2390
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__123, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2390, __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, 2390, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2389
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2392
 *         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_ptype_5pysam_7libcbcf_VariantRecordFilter), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2392, __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":2393
 * 
 *     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":2395
 *     filter.record = record
 * 
 *     return filter             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_filter);
  __pyx_r = __pyx_v_filter;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2388
 * 
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2401
 *     """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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 2401, 0, __PYX_ERR(0, 2401, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2402
 *        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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2402, __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, 2402, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2401
 *     """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_AddTraceback("pysam.libcbcf.VariantRecordFormat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2404
 *         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_TraceDeclarations
  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_TraceCall("__len__", __pyx_f[0], 2404, 0, __PYX_ERR(0, 2404, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2405
 * 
 *     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":2406
 *     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":2407
 *         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":2409
 *         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":2410
 * 
 *         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":2411
 *         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":2410
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
 */
    }
  }

  /* "pysam/libcbcf.pyx":2412
 *             if r.d.fmt[i].p:
 *                 n += 1
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_n;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2404
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFormat.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2414
 *         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_TraceDeclarations
  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_TraceCall("__bool__", __pyx_f[0], 2414, 0, __PYX_ERR(0, 2414, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2415
 * 
 *     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":2416
 *     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":2419
 *         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":2420
 * 
 *         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":2421
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":2420
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    }
  }

  /* "pysam/libcbcf.pyx":2422
 *             if r.d.fmt[i].p:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2414
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFormat.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2424
 *         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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 2424, 0, __PYX_ERR(0, 2424, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2425
 * 
 *     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":2426
 *     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":2428
 *         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, 2428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2429
 * 
 *         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, 2429, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2429, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2431
 *         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":2432
 * 
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_format, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 2432, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2431
 *         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":2434
 *             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_7 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_7), BCF_HL_FMT, __pyx_v_fmt->id)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2424
 *         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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2436
 *         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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 1);
  __Pyx_TraceCall("__delitem__", __pyx_f[0], 2436, 0, __PYX_ERR(0, 2436, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2437
 * 
 *     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":2438
 *     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":2440
 *         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, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2441
 * 
 *         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, 2441, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2441, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2443
 *         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":2444
 * 
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_format, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 2444, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2443
 *         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":2446
 *             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, 2446, __pyx_L1_error)
  }
  __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 2446, __pyx_L1_error)
  __pyx_t_5 = (bcf_update_format(__pyx_v_hdr, __pyx_v_r, __pyx_t_10, __pyx_v_fmt->p, 0, __pyx_v_fmt->type) < 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2447
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:
 *             raise ValueError('Unable to delete FORMAT')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__124, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2447, __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, 2447, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2446
 *             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":2436
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2449
 *             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)\nClear all formats for all samples within the associated\n           :class:`VariantRecord` instance");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_11clear = {"clear", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__125)
  __Pyx_RefNannySetupContext("clear", 1);
  __Pyx_TraceCall("clear", __pyx_f[0], 2449, 0, __PYX_ERR(0, 2449, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2452
 *         """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":2453
 *            :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":2458
 *         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":2459
 * 
 *         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":2460
 *         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":2461
 *             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":2462
 *             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":2463
 *                 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_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__124, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2463, __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, 2463, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2462
 *             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":2460
 *         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":2449
 *             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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2465
 *                     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_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__, __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, 2465, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordFormat___iter, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2465, __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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2465, 0, __PYX_ERR(0, 2465, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2465, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2466
 * 
 *     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":2467
 *     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":2471
 *         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":2472
 * 
 *         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":2473
 *         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":2474
 *             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, 2474, __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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_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, 2474, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2473
 *         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);

  /* "pysam/libcbcf.pyx":2465
 *                     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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2476
 *                 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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2476, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2476, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 2476, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2476, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__126)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 2476, 0, __PYX_ERR(0, 2476, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2478
 *     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":2479
 *         """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, 2479, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2478
 *     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;

    /* "pysam/libcbcf.pyx":2480
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2480, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":2481
 *             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_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":2478
 *     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":2476
 *                 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_AddTraceback("pysam.libcbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2483
 *             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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 2483, 0, __PYX_ERR(0, 2483, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2484
 * 
 *     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":2485
 *     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":2486
 *         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, 2486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2487
 *         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, 2487, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2487, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2488
 *         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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2483
 *             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_AddTraceback("pysam.libcbcf.VariantRecordFormat.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2490
 *         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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__127)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 2490, 0, __PYX_ERR(0, 2490, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2492
 *     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, 2492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2490
 *         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_AddTraceback("pysam.libcbcf.VariantRecordFormat.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2494
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_22itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues, __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, 2494, __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, __pyx_codeobj__128, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordFormat_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2494, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__128)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 2494, 0, __PYX_ERR(0, 2494, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2494, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2496
 *     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, 2496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2496, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2496, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2496, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2496, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2496, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2496, __pyx_L1_error)
        }
        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":2497
 *         """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, 2497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2497, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2496
 *     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);

  /* "pysam/libcbcf.pyx":2494
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":2499
 *             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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_25iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems, __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, 2499, __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, __pyx_codeobj__129, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordFormat_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2499, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__129)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 2499, 0, __PYX_ERR(0, 2499, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2499, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2501
 *     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, 2501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2501, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2501, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2501, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2501, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 2501, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2501, __pyx_L1_error)
        }
        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":2502
 *         """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, 2502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2502, __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)) __PYX_ERR(0, 2502, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 2502, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2502, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2501
 *     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);

  /* "pysam/libcbcf.pyx":2499
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2504
 *             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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_28keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__130)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 2504, 0, __PYX_ERR(0, 2504, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2506
 *     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, 2506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2504
 *             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_AddTraceback("pysam.libcbcf.VariantRecordFormat.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2508
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_30items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__131)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 2508, 0, __PYX_ERR(0, 2508, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2510
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2508
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2512
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_32values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__132)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 2512, 0, __PYX_ERR(0, 2512, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2514
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2512
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__133)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__134)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2522
 * 
 * 
 * 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_TraceDeclarations
  __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("makeVariantRecordFormat", 1);
  __Pyx_TraceCall("makeVariantRecordFormat", __pyx_f[0], 2522, 0, __PYX_ERR(0, 2522, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2523
 * 
 * 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, 2523, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2524
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__123, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __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, 2524, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2523
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2526
 *         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_ptype_5pysam_7libcbcf_VariantRecordFormat), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2526, __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":2527
 * 
 *     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":2529
 *     format.record = record
 * 
 *     return format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_format);
  __pyx_r = __pyx_v_format;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2522
 * 
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2537
 *        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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 2537, 0, __PYX_ERR(0, 2537, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2538
 * 
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2538, __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, 2538, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2537
 *        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_AddTraceback("pysam.libcbcf.VariantRecordInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2540
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 1);
  __Pyx_TraceCall("__len__", __pyx_f[0], 2540, 0, __PYX_ERR(0, 2540, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2541
 * 
 *     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":2542
 *     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":2545
 *         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":2547
 *         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":2548
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2548, __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, 2548, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2547
 *         cdef int i, count = 0
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2550
 *             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_5 = __pyx_v_r->n_info;
  __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":2551
 * 
 *         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":2552
 *         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":2553
 *             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_8 = (__pyx_v_info != NULL);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_info->vptr != NULL);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = (strcmp(__pyx_v_key, ((char const *)"END")) != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2554
 *             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":2553
 *             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":2556
 *                 count += 1
 * 
 *         return count             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2540
 *         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_AddTraceback("pysam.libcbcf.VariantRecordInfo.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2558
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 1);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 2558, 0, __PYX_ERR(0, 2558, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2559
 * 
 *     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":2560
 *     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":2565
 *         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":2566
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2566, __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, 2566, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2565
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2568
 *             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_5 = __pyx_v_r->n_info;
  __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":2569
 * 
 *         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":2570
 *         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":2571
 *             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_8 = (__pyx_v_info != NULL);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_info->vptr != NULL);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = (strcmp(__pyx_v_key, ((char const *)"END")) != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2572
 *             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;
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":2571
 *             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":2574
 *                 return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2558
 *         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_AddTraceback("pysam.libcbcf.VariantRecordInfo.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2576
 *         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_TraceDeclarations
  __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;
  char const *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 2576, 0, __PYX_ERR(0, 2576, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2577
 * 
 *     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":2578
 *     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":2580
 *         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":2581
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2581, __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, 2581, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2580
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2583
 *             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, 2583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2585
 *         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, 2585, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2585, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_5, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2586
 * 
 *         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_4 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2586, __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, 2586, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2585
 *         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":2588
 *             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, 2588, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 2588, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_6);

  /* "pysam/libcbcf.pyx":2591
 * 
 *         # 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_8 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_8 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2591, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_7;

  /* "pysam/libcbcf.pyx":2593
 *         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":2594
 * 
 *         if info_id < 0:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_11 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(0, 2594, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2593
 *         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":2596
 *             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, 2596, __pyx_L1_error)
  __pyx_t_12 = (!__pyx_t_3);
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2597
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle type=Flag values
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2597, __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, 2597, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2596
 *             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":2600
 * 
 *         # 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_12 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_12) {

    /* "pysam/libcbcf.pyx":2601
 *         # 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_12 = (__pyx_v_info != NULL);
    if (__pyx_t_12) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_info->vptr != NULL);
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_L8_bool_binop_done:;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2600
 * 
 *         # 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":2603
 *             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_12 = __pyx_t_3;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_12 = __pyx_t_3;
  __pyx_L11_bool_binop_done:;
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2604
 * 
 *         if not info or not info.vptr:
 *             raise KeyError('Invalid INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return bcf_info_get_value(self.record, info)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_11 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 2604, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2603
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Invalid INFO field: {}'.format(key))
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2606
 *             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_9 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2576
 *         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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2608
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 1);
  __Pyx_TraceCall("__setitem__", __pyx_f[0], 2608, 0, __PYX_ERR(0, 2608, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2609
 * 
 *     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, 2609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bkey = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2611
 *         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, 2611, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2611, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_2, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2612
 * 
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2612, __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, 2612, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2611
 *         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":2614
 *             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":2615
 * 
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2615, __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, 2615, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2614
 *             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":2617
 *             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, 2617, __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":2608
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2619
 *         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_TraceDeclarations
  __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;
  char const *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  int __pyx_t_12;
  char const *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 1);
  __Pyx_TraceCall("__delitem__", __pyx_f[0], 2619, 0, __PYX_ERR(0, 2619, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2620
 * 
 *     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":2621
 *     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":2623
 *         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, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2624
 * 
 *         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, 2624, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2624, __pyx_L1_error)
  __pyx_t_5 = (strcmp(__pyx_t_4, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2625
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2625, __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, 2625, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2624
 * 
 *         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":2627
 *             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":2628
 * 
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2628, __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, 2628, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2627
 *             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":2630
 *             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, 2630, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 2630, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_6);

  /* "pysam/libcbcf.pyx":2633
 * 
 *         # 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_8 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_8 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2633, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_7;

  /* "pysam/libcbcf.pyx":2635
 *         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":2636
 * 
 *         if info_id < 0:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_11 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2636, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(0, 2636, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2635
 *         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":2638
 *             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, 2638, __pyx_L1_error)
  __pyx_t_12 = (!__pyx_t_5);
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2639
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2639, __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, 2639, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2638
 *             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":2642
 * 
 *         # 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_12 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info != 0));
  if (!__pyx_t_5) {
  } else {
    __pyx_t_12 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_12 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_12) {

    /* "pysam/libcbcf.pyx":2643
 *         # 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":2642
 * 
 *         # 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":2645
 *             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_12 = __pyx_t_5;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_12 = __pyx_t_5;
  __pyx_L12_bool_binop_done:;
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2646
 * 
 *         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_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_11 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2646, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 2646, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2645
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2648
 *             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, 2648, __pyx_L1_error)
  }
  __pyx_t_13 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(0, 2648, __pyx_L1_error)
  __pyx_t_12 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_13, NULL, 0, __pyx_v_info->type) < 0);
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2649
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
 *             raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__136, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2649, __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, 2649, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2648
 *             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":2619
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2651
 *             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)\nClear all info data");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_13clear = {"clear", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__137)
  __Pyx_RefNannySetupContext("clear", 1);
  __Pyx_TraceCall("clear", __pyx_f[0], 2651, 0, __PYX_ERR(0, 2651, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2653
 *     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":2654
 *         """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":2659
 *         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":2660
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2660, __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, 2660, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2659
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2662
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 */
  __pyx_t_5 = __pyx_v_r->n_info;
  __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":2663
 * 
 *         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":2664
 *         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_8 = (__pyx_v_info != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2665
 *             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":2666
 *             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":2667
 *                 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":2666
 *             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":2668
 *                 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":2669
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__136, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2669, __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, 2669, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2668
 *                 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":2664
 *         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":2651
 *             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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2671
 *                     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_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__, __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, 2671, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordInfo___iter, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2671, __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_TraceDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2671, 0, __PYX_ERR(0, 2671, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2671, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2672
 * 
 *     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":2673
 *     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":2678
 *         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":2679
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2679, __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, 2679, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2678
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2681
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 */
  __pyx_t_5 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_7;

    /* "pysam/libcbcf.pyx":2682
 * 
 *         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":2683
 *         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_8 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2684
 *             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":2685
 *             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":2686
 *                 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, 2686, __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_5;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_TraceReturn(__pyx_r, 0);
        __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_t_5 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2686, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2685
 *             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":2683
 *         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);

  /* "pysam/libcbcf.pyx":2671
 *                     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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2688
 *                     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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2688, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2688, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 2688, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2688, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  char const *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__138)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 2688, 0, __PYX_ERR(0, 2688, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2690
 *     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":2691
 *         """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":2693
 *         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":2694
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2694, __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, 2694, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2693
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2696
 *             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, 2696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2698
 *         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, 2698, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2698, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_5, ((char const *)"END")) == 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2699
 * 
 *         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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2698
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2701
 *             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, 2701, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 2701, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_6);

  /* "pysam/libcbcf.pyx":2704
 * 
 *         # 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_8 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_8 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2704, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_7;

  /* "pysam/libcbcf.pyx":2706
 *         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, 2706, __pyx_L1_error)
  __pyx_t_9 = (!__pyx_t_3);
  if (unlikely(__pyx_t_9)) {

    /* "pysam/libcbcf.pyx":2707
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2707, __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, 2707, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2706
 *         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":2710
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             return info != NULL and info.vptr != NULL
 * 
 */
  __pyx_t_9 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_9) {

    /* "pysam/libcbcf.pyx":2711
 *         # 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_9 = (__pyx_v_info != NULL);
    if (__pyx_t_9) {
    } else {
      __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_info->vptr != NULL);
    __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __pyx_t_10;
    __pyx_t_10 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2710
 * 
 *         # 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":2713
 *             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_9 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_9 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_9) {

    /* "pysam/libcbcf.pyx":2714
 * 
 *         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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2713
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2716
 *             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_10 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2688
 *                     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_10);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2718
 *         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_TraceDeclarations
  __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;
  char const *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 2718, 0, __PYX_ERR(0, 2718, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2719
 * 
 *     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":2720
 *     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":2722
 *         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":2723
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2723, __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, 2723, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2722
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2725
 *             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, 2725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2727
 *         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, 2727, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2727, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_5, ((char const *)"END")) == 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2728
 * 
 *         if strcmp(bkey, b'END') == 0:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2727
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2730
 *             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, 2730, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 2730, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_6);

  /* "pysam/libcbcf.pyx":2732
 *         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_7 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_info->vptr != NULL);
  __pyx_t_7 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  __pyx_r = __pyx_t_7;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2718
 *         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_AddTraceback("pysam.libcbcf.VariantRecordInfo.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2734
 *         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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__139)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 2734, 0, __PYX_ERR(0, 2734, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2736
 *     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, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2734
 *         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_AddTraceback("pysam.libcbcf.VariantRecordInfo.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2738
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_24itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues, __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, 2738, __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, __pyx_codeobj__140, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordInfo_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2738, __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_TraceDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __Pyx_TraceFrameInit(__pyx_codeobj__140)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 2738, 0, __PYX_ERR(0, 2738, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2738, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2740
 *     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":2741
 *         """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":2746
 *         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":2747
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2747, __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, 2747, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2746
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2749
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 */
  __pyx_t_5 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_7;

    /* "pysam/libcbcf.pyx":2750
 * 
 *         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":2751
 *         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_8 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2752
 *             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":2753
 *             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":2754
 *                 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_9 = __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_9)) __PYX_ERR(0, 2754, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_5;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_TraceReturn(__pyx_r, 0);
        __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_t_5 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2754, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2753
 *             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":2751
 *         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);

  /* "pysam/libcbcf.pyx":2738
 *         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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":2756
 *                     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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_27iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems, __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, 2756, __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, __pyx_codeobj__141, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordInfo_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2756, __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_TraceDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __Pyx_TraceFrameInit(__pyx_codeobj__141)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 2756, 0, __PYX_ERR(0, 2756, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2756, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2758
 *     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":2759
 *         """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":2764
 *         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":2765
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2765, __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, 2765, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2764
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2767
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 */
  __pyx_t_5 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_7;

    /* "pysam/libcbcf.pyx":2768
 * 
 *         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":2769
 *         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_8 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2770
 *             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":2771
 *             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":2772
 *                 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_9 = __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_9)) __PYX_ERR(0, 2772, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __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_9);
        __Pyx_GIVEREF(__pyx_t_9);
        __pyx_t_9 = 0;

        /* "pysam/libcbcf.pyx":2773
 *                 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_9 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2773, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2773, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_9);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9)) __PYX_ERR(0, 2773, __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)) __PYX_ERR(0, 2773, __pyx_L1_error);
        __pyx_t_9 = 0;
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_5;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_TraceReturn(__pyx_r, 0);
        __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_t_5 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2773, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2771
 *             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":2769
 *         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);

  /* "pysam/libcbcf.pyx":2756
 *                     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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2775
 *                     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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_30keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__142)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 2775, 0, __PYX_ERR(0, 2775, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2777
 *     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, 2777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2775
 *                     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_AddTraceback("pysam.libcbcf.VariantRecordInfo.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2779
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_32items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__143)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 2779, 0, __PYX_ERR(0, 2779, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2781
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2779
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2783
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_34values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__144)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 2783, 0, __PYX_ERR(0, 2783, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2785
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2783
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2787
 *         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)\nD.update([E, ]**F) -> None.\n\n        Update D from dict/iterable E and F.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_36update = {"update", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_items,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2787, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 2787, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2787, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__145)
  __Pyx_RefNannySetupContext("update", 1);
  __Pyx_TraceCall("update", __pyx_f[0], 2787, 0, __PYX_ERR(0, 2787, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2792
 *         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, 2792, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2792, __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, 2792, __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":2793
 *         """
 *         for k, v in items.items():
 *             if k != 'END':             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
 */
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_k, __pyx_n_u_END, Py_NE)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2793, __pyx_L1_error)
    if (__pyx_t_8) {

      /* "pysam/libcbcf.pyx":2794
 *         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, 2794, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2793
 *         """
 *         for k, v in items.items():
 *             if k != 'END':             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2796
 *                 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, 2796, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":2797
 * 
 *         if kwargs:
 *             kwargs.pop('END', None)             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
 */
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_u_END, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2798
 *         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_n_s_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2798, __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, 2798, __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":2799
 *             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, 2799, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2796
 *                 self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             kwargs.pop('END', None)
 *             for k, v in kwargs.items():
 */
  }

  /* "pysam/libcbcf.pyx":2787
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2801
 *                 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__146);
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 2801, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2801, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  unsigned int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__147)
  __Pyx_RefNannySetupContext("pop", 1);
  __Pyx_TraceCall("pop", __pyx_f[0], 2801, 0, __PYX_ERR(0, 2801, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2802
 * 
 *     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":2803
 *     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":2805
 *         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":2806
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2806, __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, 2806, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2805
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2808
 *             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, 2808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2809
 * 
 *         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, 2809, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2809, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_5);

  /* "pysam/libcbcf.pyx":2812
 * 
 *         # 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_7 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_7 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2812, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_6;

  /* "pysam/libcbcf.pyx":2814
 *         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":2815
 * 
 *         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":2816
 *         if info_id < 0:
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2816, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 2816, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2815
 * 
 *         if info_id < 0:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
 */
    }

    /* "pysam/libcbcf.pyx":2817
 *             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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2814
 *         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":2819
 *             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, 2819, __pyx_L1_error)
  __pyx_t_11 = (!__pyx_t_3);
  if (unlikely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":2820
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
 */
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 2820, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2819
 *             return default
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2823
 * 
 *         # 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_11 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_11 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_11 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":2824
 *         # 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":2823
 * 
 *         # 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":2826
 *             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_11 = __pyx_t_3;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_11 = __pyx_t_3;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":2827
 * 
 *         if not info or not info.vptr:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
 */
    __pyx_t_11 = (__pyx_v_default == __pyx_v_5pysam_7libcbcf__nothing);
    if (unlikely(__pyx_t_11)) {

      /* "pysam/libcbcf.pyx":2828
 *         if not info or not info.vptr:
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2828, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 2828, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2827
 * 
 *         if not info or not info.vptr:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
 */
    }

    /* "pysam/libcbcf.pyx":2829
 *             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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2826
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 */
  }

  /* "pysam/libcbcf.pyx":2831
 *             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_8 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_value = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pysam/libcbcf.pyx":2833
 *         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, 2833, __pyx_L1_error)
  }
  __pyx_t_12 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2833, __pyx_L1_error)
  __pyx_t_11 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_12, NULL, 0, __pyx_v_info->type) < 0);
  if (unlikely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":2834
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
 *             raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *         return value
 */
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__136, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2834, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 2834, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2833
 *         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":2836
 *             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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2801
 *                 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2838
 *         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, 2838, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, 0, "other", 0))) __PYX_ERR(0, 2838, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 1);
  __Pyx_TraceCall("__richcmp__", __pyx_f[0], 2838, 0, __PYX_ERR(0, 2838, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2839
 * 
 *     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":2840
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2839
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2842
 *             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":2843
 * 
 *         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":2846
 * 
 *         # Cannot use n_info as shortcut logic, since null values may remain
 *         cdef bint cmp = dict(self) == dict(other)             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), ((PyObject *)__pyx_v_other)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2848
 *         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":2849
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
 */
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2848
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2851
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2838
 *         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_AddTraceback("pysam.libcbcf.VariantRecordInfo.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__148)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__149)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2857
 * 
 * 
 * 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_TraceDeclarations
  __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("makeVariantRecordInfo", 1);
  __Pyx_TraceCall("makeVariantRecordInfo", __pyx_f[0], 2857, 0, __PYX_ERR(0, 2857, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2858
 * 
 * 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, 2858, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2859
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__123, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2859, __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, 2859, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2858
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2861
 *         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_ptype_5pysam_7libcbcf_VariantRecordInfo), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2861, __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":2862
 * 
 *     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":2864
 *     info.record = record
 * 
 *     return info             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2857
 * 
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2869
 * 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 2869, 0, __PYX_ERR(0, 2869, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2870
 *     """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_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2870, __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, 2870, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2869
 * 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_AddTraceback("pysam.libcbcf.VariantRecordSamples.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2872
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__len__", __pyx_f[0], 2872, 0, __PYX_ERR(0, 2872, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2873
 * 
 *     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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2872
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSamples.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2875
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__bool__", __pyx_f[0], 2875, 0, __PYX_ERR(0, 2875, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2876
 * 
 *     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);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2875
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSamples.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2878
 *         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_TraceDeclarations
  __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;
  unsigned int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 2878, 0, __PYX_ERR(0, 2878, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2879
 * 
 *     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":2880
 *     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":2881
 *         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":2886
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2887
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             bkey = force_bytes(key)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2887, __pyx_L1_error)
    __pyx_v_sample_index = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2886
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2889
 *             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, 2889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2890
 *         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, 2890, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2890, __pyx_L1_error)
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_SAMPLE, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2891
 *             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":2892
 *             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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_sample_name, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 2892, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2891
 *             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":2894
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
 *         if sample_index < 0 or sample_index >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
 */
  __pyx_t_11 = (__pyx_v_sample_index < 0);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_4 = __pyx_t_11;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_sample_index >= __pyx_v_n);
  __pyx_t_4 = __pyx_t_11;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":2895
 * 
 *         if sample_index < 0 or sample_index >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecordSample(self.record, sample_index)
 */
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 2895, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2894
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
 *         if sample_index < 0 or sample_index >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2897
 *             raise IndexError('invalid sample index')
 * 
 *         return makeVariantRecordSample(self.record, sample_index)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_8), __pyx_v_sample_index)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2878
 *         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_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_TraceReturn(__pyx_r, 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":2899
 *         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_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__, __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, 2899, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordSamples___iter, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2899, __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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2899, 0, __PYX_ERR(0, 2899, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2899, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2900
 * 
 *     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":2901
 *     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":2902
 *         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":2904
 *         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":2905
 * 
 *         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, 2905, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2905, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysam/libcbcf.pyx":2899
 *         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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2907
 *             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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2907, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2907, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 2907, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2907, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__150)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 2907, 0, __PYX_ERR(0, 2907, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2909
 *     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":2910
 *         """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, 2910, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2909
 *     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;

    /* "pysam/libcbcf.pyx":2911
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2911, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":2912
 *             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_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":2909
 *     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":2907
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2914
 *             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_TraceDeclarations
  __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;
  unsigned int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 2914, 0, __PYX_ERR(0, 2914, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2915
 * 
 *     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":2916
 *     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":2917
 *         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":2922
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2923
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             bkey = force_bytes(key)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2923, __pyx_L1_error)
    __pyx_v_sample_index = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2922
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2925
 *             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, 2925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2926
 *         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, 2926, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2926, __pyx_L1_error)
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_SAMPLE, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2927
 *             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":2928
 *             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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_sample_name, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2928, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 2928, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2927
 *             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":2930
 *                 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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2914
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2932
 *         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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__151)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 2932, 0, __PYX_ERR(0, 2932, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2934
 *     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, 2934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2932
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSamples.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":2936
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_18itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues, __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, 2936, __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, __pyx_codeobj__152, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordSamples_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2936, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__152)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 2936, 0, __PYX_ERR(0, 2936, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2936, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2938
 *     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":2939
 *         """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":2940
 *         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":2942
 *         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":2943
 * 
 *         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, 2943, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2943, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysam/libcbcf.pyx":2936
 *         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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":2945
 *             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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_21iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems, __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, 2945, __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, __pyx_codeobj__153, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordSamples_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2945, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__153)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 2945, 0, __PYX_ERR(0, 2945, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2945, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2947
 *     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":2948
 *         """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":2949
 *         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":2951
 *         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":2952
 * 
 *         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, 2952, __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, 2952, __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, 2952, __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)) __PYX_ERR(0, 2952, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_9);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9)) __PYX_ERR(0, 2952, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 2952, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysam/libcbcf.pyx":2945
 *             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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2954
 *             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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_24keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__154)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 2954, 0, __PYX_ERR(0, 2954, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2956
 *     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, 2956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2954
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSamples.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2958
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_26items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__155)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 2958, 0, __PYX_ERR(0, 2958, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2960
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2958
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2962
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_28values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__156)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 2962, 0, __PYX_ERR(0, 2962, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2964
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2962
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2966
 *         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)\nD.update([E, ]**F) -> None.\n\n        Update D from dict/iterable E and F.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_30update = {"update", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_items,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2966, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 2966, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2966, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__157)
  __Pyx_RefNannySetupContext("update", 1);
  __Pyx_TraceCall("update", __pyx_f[0], 2966, 0, __PYX_ERR(0, 2966, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2971
 *         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, 2971, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2971, __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, 2971, __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":2972
 *         """
 *         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, 2972, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2974
 *             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, 2974, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":2975
 * 
 *         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_n_s_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2975, __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, 2975, __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":2976
 *         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, 2976, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2974
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
 */
  }

  /* "pysam/libcbcf.pyx":2966
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2978
 *                 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__158);
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2978, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2978, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 2978, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 2978, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__159)
  __Pyx_RefNannySetupContext("pop", 1);
  __Pyx_TraceCall("pop", __pyx_f[0], 2978, 0, __PYX_ERR(0, 2978, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2979
 * 
 *     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":2980
 *     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, 2980, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":2981
 *         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, 2981, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":2982
 *             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;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2979
 * 
 *     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;

    /* "pysam/libcbcf.pyx":2983
 *             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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2983, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":2984
 *             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":2985
 *         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_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":2984
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
 */
      }

      /* "pysam/libcbcf.pyx":2986
 *             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_ERR(0, 2986, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":2979
 * 
 *     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":2978
 *                 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2988
 *             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, 2988, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, 0, "other", 0))) __PYX_ERR(0, 2988, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __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;
  unsigned int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 1);
  __Pyx_TraceCall("__richcmp__", __pyx_f[0], 2988, 0, __PYX_ERR(0, 2988, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2989
 * 
 *     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":2990
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2989
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "pysam/libcbcf.pyx":2992
 *             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":2993
 * 
 *         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":2995
 *         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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __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, 2995, __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, 2995, __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":2997
 *         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":2998
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
 */
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2997
 *         cdef bint cmp = (s.n_sample == o.n_sample and self.values() == other.values())
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3000
 *             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, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2988
 *             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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__160)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_118286449)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__161)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3006
 * 
 * 
 * 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_TraceDeclarations
  __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("makeVariantRecordSamples", 1);
  __Pyx_TraceCall("makeVariantRecordSamples", __pyx_f[0], 3006, 0, __PYX_ERR(0, 3006, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3007
 * 
 * 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, 3007, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3008
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSamples samples = VariantRecordSamples.__new__(
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__123, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3008, __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, 3008, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3007
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3010
 *         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_ptype_5pysam_7libcbcf_VariantRecordSamples), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3010, __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":3012
 *     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":3014
 *     samples.record = record
 * 
 *     return samples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_samples);
  __pyx_r = __pyx_v_samples;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3006
 * 
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3019
 * 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3019, 0, __PYX_ERR(0, 3019, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3020
 *     """Variant record"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3020, __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, 3020, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3019
 * 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_AddTraceback("pysam.libcbcf.VariantRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3022
 *         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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3022, 0, __PYX_ERR(0, 3022, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3023
 * 
 *     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":3024
 *     def __dealloc__(self):
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    bcf_destroy1(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3025
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
    __pyx_v_self->ptr = NULL;

    /* "pysam/libcbcf.pyx":3023
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL
 */
  }

  /* "pysam/libcbcf.pyx":3022
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantRecord.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3027
 *             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)\nreturn a copy of this VariantRecord object");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantRecord_5copy = {"copy", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__162)
  __Pyx_RefNannySetupContext("copy", 1);
  __Pyx_TraceCall("copy", __pyx_f[0], 3027, 0, __PYX_ERR(0, 3027, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3029
 *     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, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3027
 *             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_AddTraceback("pysam.libcbcf.VariantRecord.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3031
 *         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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_dst_header,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst_header)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3031, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "translate") < 0)) __PYX_ERR(0, 3031, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 3031, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_ptype_5pysam_7libcbcf_VariantHeader, 1, "dst_header", 0))) __PYX_ERR(0, 3031, __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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  bcf_hdr_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_TraceFrameInit(__pyx_codeobj__163)
  __Pyx_RefNannySetupContext("translate", 1);
  __Pyx_TraceCall("translate", __pyx_f[0], 3031, 0, __PYX_ERR(0, 3031, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3032
 * 
 *     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":3033
 *     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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__164, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3033, __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, 3033, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3032
 * 
 *     def translate(self, VariantHeader dst_header):
 *         if dst_header is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('dst_header must not be None')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3035
 *             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_3 = __pyx_v_self->header->ptr;
  __pyx_v_src_hdr = __pyx_t_3;

  /* "pysam/libcbcf.pyx":3036
 * 
 *         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_3 = __pyx_v_dst_header->ptr;
  __pyx_v_dst_hdr = __pyx_t_3;

  /* "pysam/libcbcf.pyx":3038
 *         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":3039
 * 
 *         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":3040
 *         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_kp_u_Cannot_translate_record_Number_o);
      __pyx_v_msg = __pyx_kp_u_Cannot_translate_record_Number_o;

      /* "pysam/libcbcf.pyx":3041
 *             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_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->ptr->n_sample); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyInt_From_int32_t(bcf_hdr_nsamples(__pyx_v_dst_hdr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyUnicode_Type_format, __pyx_v_msg, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3041, __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, 3041, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3039
 * 
 *         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":3043
 *                 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":3044
 * 
 *             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":3038
 *         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":3031
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3046
 *             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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3046, 0, __PYX_ERR(0, 3046, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3049
 *     def rid(self):
 *         """internal reference id number"""
 *         return self.ptr.rid             # <<<<<<<<<<<<<<
 * 
 *     @rid.setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->ptr->rid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3046
 *             self.header = dst_header
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rid(self):
 *         """internal reference id number"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3051
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3051, 0, __PYX_ERR(0, 3051, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3053
 *     @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":3054
 *     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_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3054, __pyx_L1_error)
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3055
 *         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":3056
 *         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_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__165, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3056, __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, 3056, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3055
 *         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":3057
 *         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":3051
 *         return self.ptr.rid
 * 
 *     @rid.setter             # <<<<<<<<<<<<<<
 *     def rid(self, value):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3059
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3059, 0, __PYX_ERR(0, 3059, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3062
 *     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":3063
 *         """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":3064
 *         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":3065
 *         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_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3065, __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, 3065, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3064
 *         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":3066
 *         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, 3066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3059
 *         self.ptr.rid = r
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def chrom(self):
 *         """chromosome/contig name"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.chrom.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3068
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3068, 0, __PYX_ERR(0, 3068, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3070
 *     @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":3071
 *     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, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bchrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3072
 *         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, 3072, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bchrom); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 3072, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/libcbcf.pyx":3073
 *         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":3074
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__166, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3074, __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, 3074, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3073
 *         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":3075
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_4 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_self->ptr->rid = __pyx_t_4;

  /* "pysam/libcbcf.pyx":3068
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.chrom.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bchrom);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3077
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3077, 0, __PYX_ERR(0, 3077, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3080
 *     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":3081
 *         """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":3082
 *         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":3083
 *         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_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3083, __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, 3083, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3082
 *         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":3084
 *         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, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3077
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.contig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3086
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3086, 0, __PYX_ERR(0, 3086, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3088
 *     @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":3089
 *     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, 3089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bchrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3090
 *         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, 3090, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bchrom); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 3090, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/libcbcf.pyx":3091
 *         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":3092
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__166, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3092, __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, 3092, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3091
 *         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":3093
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_4 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_self->ptr->rid = __pyx_t_4;

  /* "pysam/libcbcf.pyx":3086
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.contig.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bchrom);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3095
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3095, 0, __PYX_ERR(0, 3095, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3098
 *     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_PyInt_From_long((__pyx_v_self->ptr->pos + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3095
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3100
 *         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_TraceDeclarations
  __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("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3100, 0, __PYX_ERR(0, 3100, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3102
 *     @pos.setter
 *     def pos(self, value):
 *         cdef int p = value             # <<<<<<<<<<<<<<
 *         if p < 1:
 *             raise ValueError('Position must be positive')
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3102, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3103
 *     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":3104
 *         cdef int p = value
 *         if p < 1:
 *             raise ValueError('Position must be positive')             # <<<<<<<<<<<<<<
 *         self.ptr.pos = p - 1
 *         bcf_sync_end(self)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__167, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3104, __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, 3104, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3103
 *     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":3105
 *         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":3106
 *             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, 3106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3100
 *         return self.ptr.pos + 1
 * 
 *     @pos.setter             # <<<<<<<<<<<<<<
 *     def pos(self, value):
 *         cdef int p = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3108
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3108, 0, __PYX_ERR(0, 3108, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3111
 *     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_PyInt_From_int32_t(__pyx_v_self->ptr->pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3108
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3113
 *         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_TraceDeclarations
  __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("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3113, 0, __PYX_ERR(0, 3113, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3115
 *     @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_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3115, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3116
 *     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":3117
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__168, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3117, __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, 3117, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3116
 *     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":3118
 *         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":3119
 *             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, 3119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3113
 *         return self.ptr.pos
 * 
 *     @start.setter             # <<<<<<<<<<<<<<
 *     def start(self, value):
 *         cdef int s = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3121
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3121, 0, __PYX_ERR(0, 3121, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3124
 *     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_PyInt_From_int32_t((__pyx_v_self->ptr->pos + __pyx_v_self->ptr->rlen)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3121
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.stop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3126
 *         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_TraceDeclarations
  __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("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3126, 0, __PYX_ERR(0, 3126, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3128
 *     @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_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3128, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3129
 *     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":3130
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__169, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3130, __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, 3130, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3129
 *     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":3131
 *         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":3132
 *             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, 3132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3126
 *         return self.ptr.pos + self.ptr.rlen
 * 
 *     @stop.setter             # <<<<<<<<<<<<<<
 *     def stop(self, value):
 *         cdef int s = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.stop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3134
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3134, 0, __PYX_ERR(0, 3134, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3137
 *     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_PyInt_From_int32_t(__pyx_v_self->ptr->rlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3134
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.rlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3139
 *         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_TraceDeclarations
  __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("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3139, 0, __PYX_ERR(0, 3139, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3141
 *     @rlen.setter
 *     def rlen(self, value):
 *         cdef int r = value             # <<<<<<<<<<<<<<
 *         self.ptr.rlen = r
 *         bcf_sync_end(self)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3141, __pyx_L1_error)
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3142
 *     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":3143
 *         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, 3143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3139
 *         return self.ptr.rlen
 * 
 *     @rlen.setter             # <<<<<<<<<<<<<<
 *     def rlen(self, value):
 *         cdef int r = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rlen.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3145
 *         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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3145, 0, __PYX_ERR(0, 3145, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3148
 *     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, 3148, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3145
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3150
 *         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_TraceDeclarations
  int __pyx_t_1;
  float __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__set__", __pyx_f[0], 3150, 0, __PYX_ERR(0, 3150, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3152
 *     @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":3153
 *     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, 3153, __pyx_L1_error)
    __pyx_v_self->ptr->qual = __pyx_t_2;

    /* "pysam/libcbcf.pyx":3152
 *     @qual.setter
 *     def qual(self, value):
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             self.ptr.qual = value
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":3155
 *             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":3150
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3166
 * #       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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3166, 0, __PYX_ERR(0, 3166, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3169
 *     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":3170
 *         """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":3171
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3171, __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, 3171, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3170
 *         """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":3174
 *         # 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":3175
 *         # 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__170, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3175, __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, 3175, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3174
 *         # 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":3176
 *         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, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_kp_b__52, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3176, __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, 3176, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3166
 * #       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_AddTraceback("pysam.libcbcf.VariantRecord.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3178
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __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_RefNannySetupContext("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3178, 0, __PYX_ERR(0, 3178, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3180
 *     @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":3181
 *     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":3182
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3182, __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, 3182, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3181
 *     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":3183
 *         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":3184
 *             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":3185
 *         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, 3185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_bid = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3186
 *         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, 3186, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_bid); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 3186, __pyx_L1_error)
    __pyx_v_idstr = __pyx_t_4;

    /* "pysam/libcbcf.pyx":3184
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             bid = force_bytes(value)
 *             idstr = bid
 */
  }

  /* "pysam/libcbcf.pyx":3187
 *             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":3188
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:
 *             raise ValueError('Error updating id')             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__171, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3188, __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, 3188, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3187
 *             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":3178
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bid);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3190
 *             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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3190, 0, __PYX_ERR(0, 3190, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3193
 *     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":3194
 *         """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":3195
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3195, __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, 3195, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3194
 *         """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":3196
 *         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_4 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[0]), NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3196, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3190
 *             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_AddTraceback("pysam.libcbcf.VariantRecord.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3198
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  uint32_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3198, 0, __PYX_ERR(0, 3198, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":3200
 *     @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":3201
 *     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":3202
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3202, __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, 3202, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3201
 *     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":3204
 *             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, 3204, __pyx_L1_error)
  __pyx_t_4 = (!__pyx_t_2);
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":3205
 *         #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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__172, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3205, __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, 3205, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3204
 *             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":3206
 *         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, 3206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3207
 *             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_4 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_r->n_allele != 0);
  __pyx_t_4 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":3208
 *         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, 3208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __pyx_v_r->n_allele;
      __pyx_t_6 = __pyx_t_5;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
        __pyx_8genexpr6__pyx_v_i = __pyx_t_7;
        __pyx_t_8 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[__pyx_8genexpr6__pyx_v_i])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3208, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 3208, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    } /* exit inner scope */
    __pyx_v_alleles = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3209
 *         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_PyInt_From_long, 1, 0, 1) < 0))) __PYX_ERR(0, 3209, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3207
 *             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":3211
 *             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, 3211, __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)) __PYX_ERR(0, 3211, __pyx_L1_error);
    __Pyx_INCREF(__pyx_kp_u_NON_REF);
    __Pyx_GIVEREF(__pyx_kp_u_NON_REF);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_NON_REF)) __PYX_ERR(0, 3211, __pyx_L1_error);
    __pyx_v_alleles = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":3212
 *         else:
 *             alleles = [value, '<NON_REF>']
 *         self.alleles = alleles             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alleles, __pyx_v_alleles) < 0) __PYX_ERR(0, 3212, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3213
 *             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, 3213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3198
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3215
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3215, 0, __PYX_ERR(0, 3215, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3218
 *     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":3219
 *         """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":3220
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3220, __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, 3220, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3219
 *         """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":3221
 *         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":3222
 *             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":3221
 *         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":3223
 *         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, 3223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3224
 *             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_4 = __pyx_v_r->n_allele;
  __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":3225
 *         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, 3225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3226
 *         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":3227
 *             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":3228
 *             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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3215
 *         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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3230
 *         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_TraceDeclarations
  __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;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  char const *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3230, 0, __PYX_ERR(0, 3230, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_values);

  /* "pysam/libcbcf.pyx":3232
 *     @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":3235
 * 
 *         # 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":3237
 *         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":3238
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         values = [force_bytes(v) for v in values]
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3238, __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, 3238, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3237
 *         cdef int rlen = r.rlen
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3240
 *             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, 3240, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_5 = __pyx_v_values; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3240, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3240, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3240, __pyx_L6_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3240, __pyx_L6_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3240, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3240, __pyx_L6_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3240, __pyx_L6_error)
          #else
          __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3240, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3240, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_v, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_8genexpr7__pyx_v_v, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3240, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 3240, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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":3242
 *         values = [force_bytes(v) for v in values]
 * 
 *         if len(values) < 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('must set at least 2 alleles')
 * 
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3242, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_6 < 2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3243
 * 
 *         if len(values) < 2:
 *             raise ValueError('must set at least 2 alleles')             # <<<<<<<<<<<<<<
 * 
 *         if b'' in values:
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__173, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3243, __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, 3243, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3242
 *         values = [force_bytes(v) for v in values]
 * 
 *         if len(values) < 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('must set at least 2 alleles')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3245
 *             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_kp_b__12, __pyx_v_values, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3245, __pyx_L1_error)
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3246
 * 
 *         if b'' in values:
 *             raise ValueError('cannot set null allele')             # <<<<<<<<<<<<<<
 * 
 *         value = b','.join(values)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__174, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3246, __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, 3246, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3245
 *             raise ValueError('must set at least 2 alleles')
 * 
 *         if b'' in values:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot set null allele')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3248
 *             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_kp_b__2, __pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_value = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3250
 *         value = b','.join(values)
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating alleles')
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_value); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 3250, __pyx_L1_error)
  __pyx_t_3 = (bcf_update_alleles_str(__pyx_v_self->header->ptr, __pyx_v_r, __pyx_t_9) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3251
 * 
 *         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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__175, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3251, __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, 3251, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3250
 *         value = b','.join(values)
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating alleles')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3254
 * 
 *         # Reset rlen if alternate allele isn't symbolic, otherwise used cached
 *         if has_symbolic_allele(self):             # <<<<<<<<<<<<<<
 *             self.ptr.rlen = rlen
 *         else:
 */
  __pyx_t_10 = __pyx_f_5pysam_7libcbcf_has_symbolic_allele(__pyx_v_self); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3254, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_10 != 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3255
 *         # 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":3254
 * 
 *         # 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":3257
 *             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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_self->ptr->rlen = __pyx_t_6;
  }
  __pyx_L14:;

  /* "pysam/libcbcf.pyx":3258
 *         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":3259
 *             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, 3259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3230
 *         return res
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, values):
 *         cdef bcf1_t *r = self.ptr
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3261
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3261, 0, __PYX_ERR(0, 3261, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3264
 *     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":3265
 *         """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":3266
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3266, __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, 3266, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3265
 *         """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":3267
 *         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_4 = (__pyx_v_r->n_allele < 2);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (!(__pyx_v_r->d.allele != 0));
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":3268
 *             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":3267
 *         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":3269
 *         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, 3269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3270
 *             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_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_r->n_allele); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_1)) __PYX_ERR(0, 3270, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3270, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3270, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3270, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3270, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3270, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3270, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3271
 *         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_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3271, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_t_8]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3272
 *         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_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3272, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    PyTuple_SET_ITEM(__pyx_v_res, __pyx_t_8, __pyx_v_a);

    /* "pysam/libcbcf.pyx":3273
 *             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":3270
 *             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_5); __pyx_t_5 = 0;

  /* "pysam/libcbcf.pyx":3274
 *             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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3261
 *         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_5);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3276
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3276, 0, __PYX_ERR(0, 3276, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":3279
 *     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":3280
 *         #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":3281
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3281, __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, 3281, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3280
 *         #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":3282
 *         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, 3282, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) {
      __pyx_t_4 = __pyx_v_value; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3282, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3282, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3282, __pyx_L6_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 3282, __pyx_L6_error)
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3282, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3282, __pyx_L6_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 3282, __pyx_L6_error)
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3282, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3282, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_v, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_8genexpr8__pyx_v_v, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3282, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 3282, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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":3283
 *             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_kp_b__12, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3283, __pyx_L1_error)
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3284
 *         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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__176, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3284, __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, 3284, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3283
 *             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":3285
 *         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_8 = (__pyx_v_r->d.allele != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_2 = __pyx_t_8;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_r->n_allele != 0);
  __pyx_t_2 = __pyx_t_8;
  __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, 3285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_kp_b__52);
    __pyx_t_3 = __pyx_kp_b__52;
  }
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3285, __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)) __PYX_ERR(0, 3285, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_v_ref = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3286
 *             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, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alleles, __pyx_t_4) < 0) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3287
 *         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":3276
 *         return res
 * 
 *     @alts.setter             # <<<<<<<<<<<<<<
 *     def alts(self, value):
 *         #FIXME: Set alleles directly -- this is stupid
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3289
 *         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_TraceDeclarations
  __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__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3289, 0, __PYX_ERR(0, 3289, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3292
 *     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":3293
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordFilter(self)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3293, __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, 3293, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3292
 *     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":3294
 *         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, 3294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3289
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.filter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3296
 *         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_TraceDeclarations
  __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__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3296, 0, __PYX_ERR(0, 3296, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3299
 *     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":3300
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordInfo(self)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3300, __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, 3300, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3299
 *     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":3301
 *         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, 3301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3296
 *         return makeVariantRecordFilter(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def info(self):
 *         """info data (see :class:`VariantRecordInfo`)"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3303
 *         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_TraceDeclarations
  __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__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3303, 0, __PYX_ERR(0, 3303, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3306
 *     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":3307
 *         """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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3307, __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, 3307, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3306
 *     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":3308
 *         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, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3303
 *         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_AddTraceback("pysam.libcbcf.VariantRecord.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3310
 *         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_TraceDeclarations
  __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__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3310, 0, __PYX_ERR(0, 3310, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3313
 *     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":3314
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_ALL) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordSamples(self)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3314, __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, 3314, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3313
 *     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":3315
 *         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, 3315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3310
 *         return makeVariantRecordFormat(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def samples(self):
 *         """sample data (see :class:`VariantRecordSamples`)"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3318
 * 
 *     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_TraceDeclarations
  __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_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3318, 0, __PYX_ERR(0, 3318, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3319
 *     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":3320
 *         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, 3320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3322
 *             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":3323
 * 
 *             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":3325
 *                 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":3326
 * 
 *                 if tp == VCF_REF:
 *                     v_type = "REF"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"
 */
      __Pyx_INCREF(__pyx_n_u_REF);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_REF);

      /* "pysam/libcbcf.pyx":3325
 *                 tp = bcf_get_variant_type(r, i)
 * 
 *                 if tp == VCF_REF:             # <<<<<<<<<<<<<<
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3327
 *                 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":3328
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"
 */
      __Pyx_INCREF(__pyx_n_u_SNP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_SNP);

      /* "pysam/libcbcf.pyx":3327
 *                 if tp == VCF_REF:
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:             # <<<<<<<<<<<<<<
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3329
 *                 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":3330
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"
 */
      __Pyx_INCREF(__pyx_n_u_MNP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_MNP);

      /* "pysam/libcbcf.pyx":3329
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:             # <<<<<<<<<<<<<<
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3331
 *                 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":3332
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"
 */
      __Pyx_INCREF(__pyx_n_u_INDEL);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_INDEL);

      /* "pysam/libcbcf.pyx":3331
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:             # <<<<<<<<<<<<<<
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3333
 *                 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":3334
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_OVERLAP:
 *                     v_type = "OVERLAP"
 */
      __Pyx_INCREF(__pyx_n_u_BND);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_BND);

      /* "pysam/libcbcf.pyx":3333
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:             # <<<<<<<<<<<<<<
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3335
 *                 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":3336
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:
 *                     v_type = "OVERLAP"             # <<<<<<<<<<<<<<
 *                 else:
 *                     v_type = "OTHER"
 */
      __Pyx_INCREF(__pyx_n_u_OVERLAP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_OVERLAP);

      /* "pysam/libcbcf.pyx":3335
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:             # <<<<<<<<<<<<<<
 *                     v_type = "OVERLAP"
 *                 else:
 */
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3338
 *                     v_type = "OVERLAP"
 *                 else:
 *                     v_type = "OTHER"             # <<<<<<<<<<<<<<
 * 
 *                 PyTuple_SET_ITEM(result, i, v_type)
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_n_u_OTHER);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_n_u_OTHER);
    }
    __pyx_L5:;

    /* "pysam/libcbcf.pyx":3340
 *                     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":3341
 * 
 *                 PyTuple_SET_ITEM(result, i, v_type)
 *                 Py_INCREF(v_type)             # <<<<<<<<<<<<<<
 * 
 *             return result
 */
    Py_INCREF(__pyx_v_v_type);
  }

  /* "pysam/libcbcf.pyx":3343
 *                 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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3318
 * 
 *     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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3345
 *             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, 3345, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5pysam_7libcbcf_VariantRecord, 0, "other", 0))) __PYX_ERR(0, 3345, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __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_RefNannySetupContext("__richcmp__", 1);
  __Pyx_TraceCall("__richcmp__", __pyx_f[0], 3345, 0, __PYX_ERR(0, 3345, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3346
 * 
 *     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":3347
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3346
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3349
 *             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":3350
 * 
 *         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":3352
 *         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":3353
 * 
 *         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":3354
 *         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":3355
 *                              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":3356
 *                         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":3357
 *                         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":3358
 *                           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":3359
 *                         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_n_s_contig); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s_contig); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3359, __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, 3359, __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, 3359, __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":3360
 *                         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_n_s_alleles); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s_alleles); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3360, __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, 3360, __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, 3360, __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":3361
 *                         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_n_s_id); 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_n_s_id); 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  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_n_s_info); 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_n_s_info); 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.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_n_s_filter); 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_n_s_filter); 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.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_n_s_samples); 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_n_s_samples); 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;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3366
 *                         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":3367
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
 */
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":3366
 *                         and  self.samples == other.samples)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3369
 *             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, 3369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3345
 *             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_AddTraceback("pysam.libcbcf.VariantRecord.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3371
 *         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_TraceDeclarations
  __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("__str__", 1);
  __Pyx_TraceCall("__str__", __pyx_f[0], 3371, 0, __PYX_ERR(0, 3371, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3375
 *         cdef char c
 * 
 *         line.l = line.m = 0             # <<<<<<<<<<<<<<
 *         line.s = NULL
 * 
 */
  __pyx_v_line.l = 0;
  __pyx_v_line.m = 0;

  /* "pysam/libcbcf.pyx":3376
 * 
 *         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":3378
 *         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":3379
 * 
 *         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":3380
 *         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":3379
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
 *             if line.m:             # <<<<<<<<<<<<<<
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')
 */
    }

    /* "pysam/libcbcf.pyx":3381
 *             if line.m:
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')             # <<<<<<<<<<<<<<
 * 
 *         # Strip CR/LF?
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__177, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3381, __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, 3381, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3378
 *         line.s = NULL
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:             # <<<<<<<<<<<<<<
 *             if line.m:
 *                 free(line.s)
 */
  }

  /* "pysam/libcbcf.pyx":3390
 *         #    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, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3392
 *         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":3393
 * 
 *         if line.m:
 *             free(line.s)             # <<<<<<<<<<<<<<
 * 
 *         return ret
 */
    free(__pyx_v_line.s);

    /* "pysam/libcbcf.pyx":3392
 *         ret = charptr_to_str_w_len(line.s, line.l)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3395
 *             free(line.s)
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3371
 *         return cmp
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef kstring_t line
 *         cdef char c
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 81, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__178)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__179)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3398
 * 
 * 
 * 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  unsigned int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeVariantRecord", 1);
  __Pyx_TraceCall("makeVariantRecord", __pyx_f[0], 3398, 0, __PYX_ERR(0, 3398, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3399
 * 
 * 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, 3399, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3400
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not r:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3400, __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, 3400, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3399
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3402
 *         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":3403
 * 
 *     if not r:
 *         raise ValueError('cannot create VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if r.errcode:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__180, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3403, __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, 3403, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3402
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not r:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3405
 *         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":3406
 * 
 *     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, 3406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_msg = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3411
 *         #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":3412
 *         #    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_4 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_kp_u_invalid_number_of_columns); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3412, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3411
 *         #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":3413
 *         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":3414
 *             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_4 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_kp_u_limits_violated); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3414, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3413
 *         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":3415
 *         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":3416
 *             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_4 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_kp_u_invalid_character_found); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3416, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3415
 *         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":3417
 *         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":3418
 *             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_4 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_kp_u_invalid_contig_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3418, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3417
 *         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":3419
 *         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":3420
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:
 *             msg.append('invalid tag')             # <<<<<<<<<<<<<<
 * 
 *         if msg:
 */
      __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_kp_u_invalid_tag); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3420, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3419
 *         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":3422
 *             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, 3422, __pyx_L1_error)
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":3423
 * 
 *         if msg:
 *             msg = ', '.join(msg)             # <<<<<<<<<<<<<<
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
 * 
 */
      __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__181, __pyx_v_msg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":3424
 *         if msg:
 *             msg = ', '.join(msg)
 *             raise ValueError('Error(s) reading record: {}'.format(msg))             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Error_s_reading_record, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 3424, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3422
 *             msg.append('invalid tag')
 * 
 *         if msg:             # <<<<<<<<<<<<<<
 *             msg = ', '.join(msg)
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
 */
    }

    /* "pysam/libcbcf.pyx":3405
 *         raise ValueError('cannot create VariantRecord')
 * 
 *     if r.errcode:             # <<<<<<<<<<<<<<
 *         msg = []
 *         #if r.errcode & BCF_ERR_CTG_UNDEF:
 */
  }

  /* "pysam/libcbcf.pyx":3426
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)             # <<<<<<<<<<<<<<
 *     record.header = header
 *     record.ptr = r
 */
  __pyx_t_5 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecord(((PyTypeObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecord), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3426, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_5);
  __pyx_v_record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pysam/libcbcf.pyx":3427
 * 
 *     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":3428
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 *     record.header = header
 *     record.ptr = r             # <<<<<<<<<<<<<<
 * 
 *     return record
 */
  __pyx_v_record->ptr = __pyx_v_r;

  /* "pysam/libcbcf.pyx":3430
 *     record.ptr = r
 * 
 *     return record             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __pyx_r = __pyx_v_record;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3398
 * 
 * 
 * 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3444
 *        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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3444, 0, __PYX_ERR(0, 3444, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3445
 *     """
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3445, __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, 3445, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3444
 *        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_AddTraceback("pysam.libcbcf.VariantRecordSample.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3447
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3447, 0, __PYX_ERR(0, 3447, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3450
 *     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":3451
 *         """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":3452
 *         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":3454
 *         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":3455
 * 
 *         if self.index < 0 or self.index >= n:
 *             raise ValueError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return charptr_to_str(hdr.samples[self.index])
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3455, __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, 3455, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3454
 *         cdef int32_t n = r.n_sample
 * 
 *         if self.index < 0 or self.index >= n:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid sample index')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3457
 *             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, 3457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3447
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3459
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3459, 0, __PYX_ERR(0, 3459, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3462
 *     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, 3462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3459
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3464
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__set__", __pyx_f[0], 3464, 0, __PYX_ERR(0, 3464, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3466
 *     @allele_indices.setter
 *     def allele_indices(self, value):
 *         self['GT'] = value             # <<<<<<<<<<<<<<
 * 
 *     @allele_indices.deleter
 */
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_n_u_GT, __pyx_v_value) < 0))) __PYX_ERR(0, 3466, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3464
 *         return bcf_format_get_allele_indices(self)
 * 
 *     @allele_indices.setter             # <<<<<<<<<<<<<<
 *     def allele_indices(self, value):
 *         self['GT'] = value
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3468
 *         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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__del__", __pyx_f[0], 3468, 0, __PYX_ERR(0, 3468, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3470
 *     @allele_indices.deleter
 *     def allele_indices(self):
 *         self['GT'] = ()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_n_u_GT, __pyx_empty_tuple) < 0))) __PYX_ERR(0, 3470, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3468
 *         self['GT'] = value
 * 
 *     @allele_indices.deleter             # <<<<<<<<<<<<<<
 *     def allele_indices(self):
 *         self['GT'] = ()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3472
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3472, 0, __PYX_ERR(0, 3472, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3475
 *     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, 3475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3472
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3477
 *         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":3487
 *             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_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr, __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, 3487, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantRecordSample___set___loca, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3487, __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_TraceDeclarations
  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);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 3487, 0, __PYX_ERR(0, 3487, __pyx_L1_error));
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3487, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 3487, __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, 3487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3487, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3487, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3487, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3487, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3487, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3487, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3487, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3487, __pyx_L1_error)
        }
        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 *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3487, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3487, __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_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;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_TraceReturn(__pyx_r, 0);
  __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":3492
 *         # 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_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr, __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, 3492, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantRecordSample___set___loca, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3492, __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_TraceDeclarations
  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;
  unsigned int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 3492, 0, __PYX_ERR(0, 3492, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3492, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 3492, __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, 3492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3492, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3492, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3492, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3492, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3492, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3492, __pyx_L1_error)
        }
        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, 3492, __pyx_L1_error) }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->record), __pyx_n_s_alleles); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_allele};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 3492, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3477
 *         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_TraceDeclarations
  __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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__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_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__, __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, 3477, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_TraceCall("__set__", __pyx_f[0], 3477, 0, __PYX_ERR(0, 3477, __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":3483
 *         # 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_tuple__4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3483, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3483, __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_2 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3483, __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;
  }
  __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":3484
 * 
 *         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_n_u_GT, __pyx_empty_tuple) < 0))) __PYX_ERR(0, 3484, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3485
 *         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":3483
 *         # 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":3487
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
 */
  __pyx_t_4 = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___genexpr(NULL, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3488
 * 
 *         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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__182, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3488, __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, 3488, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3487
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3491
 * 
 *         # 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_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "pysam/libcbcf.pyx":3492
 *         # 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, 3492, __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, 3492, __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_n_u_GT, __pyx_t_4) < 0))) __PYX_ERR(0, 3492, __pyx_L8_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3491
 * 
 *         # determine and set allele indices:
 *         try:             # <<<<<<<<<<<<<<
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:
 */
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    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;

    /* "pysam/libcbcf.pyx":3493
 *         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_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_9) < 0) __PYX_ERR(0, 3493, __pyx_L10_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "pysam/libcbcf.pyx":3494
 *             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_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__183, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3494, __pyx_L10_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, 3494, __pyx_L10_except_error)
    }
    goto __pyx_L10_except_error;

    /* "pysam/libcbcf.pyx":3491
 * 
 *         # 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_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L13_try_end:;
  }

  /* "pysam/libcbcf.pyx":3477
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3497
 *                              "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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__del__", __pyx_f[0], 3497, 0, __PYX_ERR(0, 3497, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3499
 *     @alleles.deleter
 *     def alleles(self):
 *         self['GT'] = ()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_n_u_GT, __pyx_empty_tuple) < 0))) __PYX_ERR(0, 3499, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3497
 *                              "First set the .alleles of this record to define the alleles")
 * 
 *     @alleles.deleter             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         self['GT'] = ()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3501
 *         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_TraceDeclarations
  __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__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[0], 3501, 0, __PYX_ERR(0, 3501, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3504
 *     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, 3504, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3501
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.phased.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3506
 *         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_TraceDeclarations
  __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("__set__", 1);
  __Pyx_TraceCall("__set__", __pyx_f[0], 3506, 0, __PYX_ERR(0, 3506, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3508
 *     @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, 3508, __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, 3508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3506
 *         return bcf_sample_get_phased(self)
 * 
 *     @phased.setter             # <<<<<<<<<<<<<<
 *     def phased(self, value):
 *         bcf_sample_set_phased(self, value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.phased.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3510
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 1);
  __Pyx_TraceCall("__len__", __pyx_f[0], 3510, 0, __PYX_ERR(0, 3510, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3511
 * 
 *     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":3512
 *     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":3513
 *         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":3515
 *         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":3516
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_fmt):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3516, __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, 3516, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3515
 *         cdef int i, n = 0
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3518
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 n += 1
 */
  __pyx_t_5 = __pyx_v_r->n_fmt;
  __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":3519
 * 
 *         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":3520
 *         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":3519
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
 */
    }
  }

  /* "pysam/libcbcf.pyx":3521
 *             if r.d.fmt[i].p:
 *                 n += 1
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_n;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3510
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3523
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  uint32_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 1);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 3523, 0, __PYX_ERR(0, 3523, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3524
 * 
 *     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":3525
 *     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":3528
 *         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":3529
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_fmt):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3529, __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, 3529, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3528
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3531
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 return True
 */
  __pyx_t_5 = __pyx_v_r->n_fmt;
  __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":3532
 * 
 *         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":3533
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":3532
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    }
  }

  /* "pysam/libcbcf.pyx":3534
 *             if r.d.fmt[i].p:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3523
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3536
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 3536, 0, __PYX_ERR(0, 3536, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3537
 * 
 *     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, 3537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3536
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3539
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 1);
  __Pyx_TraceCall("__setitem__", __pyx_f[0], 3539, 0, __PYX_ERR(0, 3539, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3540
 * 
 *     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, 3540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3539
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3542
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 1);
  __Pyx_TraceCall("__delitem__", __pyx_f[0], 3542, 0, __PYX_ERR(0, 3542, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3543
 * 
 *     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, 3543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3542
 *         bcf_format_set_value(self, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         bcf_format_del_value(self, key)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3545
 *         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)\nClear all format data (including genotype) for this sample");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_13clear = {"clear", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__184)
  __Pyx_RefNannySetupContext("clear", 1);
  __Pyx_TraceCall("clear", __pyx_f[0], 3545, 0, __PYX_ERR(0, 3545, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3547
 *     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":3548
 *         """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":3552
 *         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":3553
 * 
 *         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":3554
 *         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":3555
 *             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, 3555, __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, 3555, __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":3554
 *         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":3545
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":3557
 *                 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_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__, __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, 3557, __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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordSample___iter, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3557, __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_TraceDeclarations
  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);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 3557, 0, __PYX_ERR(0, 3557, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3557, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3558
 * 
 *     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":3559
 *     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":3563
 *         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":3564
 * 
 *         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":3565
 *         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":3566
 *             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, 3566, __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_XGIVEREF(__pyx_r);
      __Pyx_TraceReturn(__pyx_r, 0);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_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, 3566, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3565
 *         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);

  /* "pysam/libcbcf.pyx":3557
 *                 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 */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3568
 *                 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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3568, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3568, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 3568, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3568, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__185)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 3568, 0, __PYX_ERR(0, 3568, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3570
 *     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":3571
 *         """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, 3571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3570
 *     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;

    /* "pysam/libcbcf.pyx":3572
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3572, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":3573
 *             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_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":3570
 *     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":3568
 *                 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_AddTraceback("pysam.libcbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3575
 *             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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 3575, 0, __PYX_ERR(0, 3575, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3576
 * 
 *     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":3577
 *     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":3578
 *         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, 3578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3579
 *         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, 3579, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 3579, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":3580
 *         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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3575
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSample.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3582
 *         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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_22iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__186)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 3582, 0, __PYX_ERR(0, 3582, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3584
 *     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, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3582
 *         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_AddTraceback("pysam.libcbcf.VariantRecordSample.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":3586
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_24itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues, __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, 3586, __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, __pyx_codeobj__187, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordSample_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3586, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__187)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 3586, 0, __PYX_ERR(0, 3586, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3586, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3588
 *     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, 3588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3588, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3588, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3588, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3588, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3588, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3588, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3588, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3588, __pyx_L1_error)
        }
        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":3589
 *         """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, 3589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 3589, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3588
 *     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);

  /* "pysam/libcbcf.pyx":3586
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":3591
 *             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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_27iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems, __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, 3591, __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, __pyx_codeobj__188, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordSample_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3591, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__188)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 3591, 0, __PYX_ERR(0, 3591, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3591, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3593
 *     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, 3593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3593, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3593, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3593, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3593, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3593, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3593, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3593, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3593, __pyx_L1_error)
        }
        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":3594
 *         """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, 3594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3594, __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)) __PYX_ERR(0, 3594, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 3594, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 3594, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3593
 *     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);

  /* "pysam/libcbcf.pyx":3591
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3596
 *             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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_30keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__189)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 3596, 0, __PYX_ERR(0, 3596, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3598
 *     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, 3598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3596
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSample.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3600
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_32items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__190)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 3600, 0, __PYX_ERR(0, 3600, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3602
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3600
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3604
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_34values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__191)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 3604, 0, __PYX_ERR(0, 3604, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3606
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3604
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3608
 *         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)\nD.update([E, ]**F) -> None.\n\n        Update D from dict/iterable E and F.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_36update = {"update", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_items,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3608, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 3608, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3608, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__192)
  __Pyx_RefNannySetupContext("update", 1);
  __Pyx_TraceCall("update", __pyx_f[0], 3608, 0, __PYX_ERR(0, 3608, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3613
 *         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, 3613, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3613, __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, 3613, __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":3614
 *         """
 *         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, 3614, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3616
 *             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, 3616, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":3617
 * 
 *         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_n_s_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3617, __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, 3617, __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":3618
 *         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, 3618, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":3616
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
 */
  }

  /* "pysam/libcbcf.pyx":3608
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3620
 *                 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__193);
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3620, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3620, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 3620, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3620, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__194)
  __Pyx_RefNannySetupContext("pop", 1);
  __Pyx_TraceCall("pop", __pyx_f[0], 3620, 0, __PYX_ERR(0, 3620, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3621
 * 
 *     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":3622
 *     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, 3622, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3623
 *         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, 3623, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":3624
 *             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;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3621
 * 
 *     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;

    /* "pysam/libcbcf.pyx":3625
 *             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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3625, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":3626
 *             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":3627
 *         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_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":3626
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
 */
      }

      /* "pysam/libcbcf.pyx":3628
 *             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_ERR(0, 3628, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3621
 * 
 *     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":3620
 *                 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3630
 *             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, 3630, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5pysam_7libcbcf_VariantRecordSample, 0, "other", 0))) __PYX_ERR(0, 3630, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 1);
  __Pyx_TraceCall("__richcmp__", __pyx_f[0], 3630, 0, __PYX_ERR(0, 3630, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3631
 * 
 *     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":3632
 *     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;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3631
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3634
 *             return NotImplemented
 * 
 *         cdef bint cmp = dict(self) == dict(other)             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), ((PyObject *)__pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3636
 *         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":3637
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
 */
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":3636
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3639
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3630
 *             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_AddTraceback("pysam.libcbcf.VariantRecordSample.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 103, 0, __PYX_ERR(3, 103, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_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;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__195)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_PyInt_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)) __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))) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_250317299);
    __Pyx_GIVEREF(__pyx_int_250317299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_250317299)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_250317299);
    __Pyx_GIVEREF(__pyx_int_250317299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_250317299)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__196)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3645
 * 
 * 
 * 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeVariantRecordSample", 1);
  __Pyx_TraceCall("makeVariantRecordSample", __pyx_f[0], 3645, 0, __PYX_ERR(0, 3645, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3646
 * 
 * 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, 3646, __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":3647
 * 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_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__197, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3647, __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, 3647, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3646
 * 
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):
 *     if not record or sample_index < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecordSample')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3649
 *         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_ptype_5pysam_7libcbcf_VariantRecordSample), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3649, __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":3650
 * 
 *     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":3651
 *     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":3653
 *     sample.index = sample_index
 * 
 *     return sample             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_sample);
  __pyx_r = __pyx_v_sample;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3645
 * 
 * 
 * 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3663
 * 
 * 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_MACROS
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3663, 0, __PYX_ERR(0, 3663, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3664
 * cdef class BaseIndex(object):
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.remap = {}
 * 
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_GOTREF(__pyx_v_self->refs);
  __Pyx_DECREF(__pyx_v_self->refs);
  __pyx_v_self->refs = __pyx_empty_tuple;

  /* "pysam/libcbcf.pyx":3665
 *     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, 3665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remap, __pyx_t_1) < 0) __PYX_ERR(0, 3665, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3663
 * 
 * cdef class BaseIndex(object):
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.remap = {}
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3667
 *         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_TraceDeclarations
  __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_RefNannySetupContext("__len__", 1);
  __Pyx_TraceCall("__len__", __pyx_f[0], 3667, 0, __PYX_ERR(0, 3667, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3668
 * 
 *     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, 3668, __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, 3668, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3667
 *         self.remap = {}
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3670
 *         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_TraceDeclarations
  __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_RefNannySetupContext("__bool__", 1);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 3670, 0, __PYX_ERR(0, 3670, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3671
 * 
 *     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, 3671, __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, 3671, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 != 0);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3670
 *         return len(self.refs)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs) != 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3673
 *         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_TraceDeclarations
  __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("__getitem__", 1);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 3673, 0, __PYX_ERR(0, 3673, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3674
 * 
 *     def __getitem__(self, key):
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             return self.refs[key]
 *         else:
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_key); 
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3675
 *     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, 3675, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_self->refs, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3674
 * 
 *     def __getitem__(self, key):
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             return self.refs[key]
 *         else:
 */
  }

  /* "pysam/libcbcf.pyx":3677
 *             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, 3677, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->refmap, __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;
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":3673
 *         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_AddTraceback("pysam.libcbcf.BaseIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3679
 *             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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 1);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 3679, 0, __PYX_ERR(0, 3679, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3680
 * 
 *     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, 3680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3679
 *             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_AddTraceback("pysam.libcbcf.BaseIndex.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3682
 *         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)\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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3682, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3682, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 3682, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3682, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__198)
  __Pyx_RefNannySetupContext("get", 1);
  __Pyx_TraceCall("get", __pyx_f[0], 3682, 0, __PYX_ERR(0, 3682, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3684
 *     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":3685
 *         """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, 3685, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3684
 *     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;

    /* "pysam/libcbcf.pyx":3686
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3686, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":3687
 *             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_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":3684
 *     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":3682
 *         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_AddTraceback("pysam.libcbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3689
 *             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_TraceDeclarations
  __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_RefNannySetupContext("__contains__", 1);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 3689, 0, __PYX_ERR(0, 3689, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3690
 * 
 *     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":3691
 *     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, 3691, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3690
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
 */
    }

    /* "pysam/libcbcf.pyx":3695
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
    /*else:*/ {
      __pyx_r = 1;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3692
 *         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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3692, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":3693
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3690
 * 
 *     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":3689
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3697
 *             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)\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_15iterkeys = {"iterkeys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iterkeys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__199)
  __Pyx_RefNannySetupContext("iterkeys", 1);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 3697, 0, __PYX_ERR(0, 3697, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3699
 *     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, 3699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3697
 *             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_AddTraceback("pysam.libcbcf.BaseIndex.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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":3701
 *         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)\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_17itervalues = {"itervalues", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "itervalues", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues, __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, 3701, __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, __pyx_codeobj__200, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_BaseIndex_itervalues, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3701, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__200)
  __Pyx_TraceCall("itervalues", __pyx_f[0], 3701, 0, __PYX_ERR(0, 3701, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3701, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3703
 *     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, 3703, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3703, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3703, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3703, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3703, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3703, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3703, __pyx_L1_error)
        }
        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":3704
 *         """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, 3704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 3704, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3703
 *     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);

  /* "pysam/libcbcf.pyx":3701
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __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":3706
 *             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)\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_20iteritems = {"iteritems", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "iteritems", 0))) 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_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems, __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, 3706, __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, __pyx_codeobj__201, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_BaseIndex_iteritems, __pyx_n_s_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3706, __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_TraceDeclarations
  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);
  __Pyx_TraceFrameInit(__pyx_codeobj__201)
  __Pyx_TraceCall("iteritems", __pyx_f[0], 3706, 0, __PYX_ERR(0, 3706, __pyx_L1_error));
  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_TraceReturn(Py_None, 0);
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3706, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3708
 *     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, 3708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3708, __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_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3708, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3708, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3708, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3708, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 3708, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3708, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3708, __pyx_L1_error)
        }
        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":3709
 *         """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, 3709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3709, __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)) __PYX_ERR(0, 3709, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 3709, __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_XGIVEREF(__pyx_r);
    __Pyx_TraceReturn(__pyx_r, 0);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_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, 3709, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3708
 *     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);

  /* "pysam/libcbcf.pyx":3706
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_Generator_Replace_StopIteration(0);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3711
 *             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)\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_23keys = {"keys", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "keys", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__202)
  __Pyx_RefNannySetupContext("keys", 1);
  __Pyx_TraceCall("keys", __pyx_f[0], 3711, 0, __PYX_ERR(0, 3711, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3713
 *     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, 3713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3711
 *             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_AddTraceback("pysam.libcbcf.BaseIndex.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3715
 *         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)\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_25items = {"items", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "items", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__203)
  __Pyx_RefNannySetupContext("items", 1);
  __Pyx_TraceCall("items", __pyx_f[0], 3715, 0, __PYX_ERR(0, 3715, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3717
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3715
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3719
 *         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)\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_27values = {"values", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "values", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__204)
  __Pyx_RefNannySetupContext("values", 1);
  __Pyx_TraceCall("values", __pyx_f[0], 3719, 0, __PYX_ERR(0, 3719, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3721
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3719
 *         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_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3723
 *         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)\nD.update([E, ]**F) -> None.\n\n        Update D from dict/iterable E and F.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_29update = {"update", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_items,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_items);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3723, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "update") < 0)) __PYX_ERR(0, 3723, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3723, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  __Pyx_DECREF(__pyx_v_kwargs);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__205)
  __Pyx_RefNannySetupContext("update", 1);
  __Pyx_TraceCall("update", __pyx_f[0], 3723, 0, __PYX_ERR(0, 3723, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3728
 *         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, 3728, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3728, __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, 3728, __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":3729
 *         """
 *         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, 3729, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3731
 *             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, 3731, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":3732
 * 
 *         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_n_s_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3732, __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, 3732, __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":3733
 *         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, 3733, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":3731
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
 */
  }

  /* "pysam/libcbcf.pyx":3723
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3735
 *                 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__206);
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3735, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_default);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3735, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pop") < 0)) __PYX_ERR(0, 3735, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3735, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__207)
  __Pyx_RefNannySetupContext("pop", 1);
  __Pyx_TraceCall("pop", __pyx_f[0], 3735, 0, __PYX_ERR(0, 3735, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3736
 * 
 *     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":3737
 *     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, 3737, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3738
 *         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, 3738, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":3739
 *             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;
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3736
 * 
 *     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;

    /* "pysam/libcbcf.pyx":3740
 *             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);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3740, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pysam/libcbcf.pyx":3741
 *             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":3742
 *         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_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":3741
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
 */
      }

      /* "pysam/libcbcf.pyx":3743
 *             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_ERR(0, 3743, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3736
 * 
 *     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":3735
 *                 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_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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __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(__pyx_codeobj__208)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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)) __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)) __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_n_s_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)) __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_n_s_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))))) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_126454353);
    __Pyx_GIVEREF(__pyx_int_126454353);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_126454353)) __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)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1)) __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)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    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_n_s_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))))) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_int_126454353);
    __Pyx_GIVEREF(__pyx_int_126454353);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_126454353)) __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)) __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)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 16, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 16, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__209)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 16, 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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3753
 * 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_MACROS
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3753, 0, __PYX_ERR(0, 3753, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3754
 *     """CSI index data structure for BCF files"""
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.refmap = {}
 * 
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__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_empty_tuple;

  /* "pysam/libcbcf.pyx":3755
 *     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, 3755, __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":3757
 *         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":3758
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__210, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3758, __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, 3758, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3757
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3761
 * 
 *         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":3763
 *         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_4.__pyx_n = 1;
    __pyx_t_4.free_after = 1;
    __pyx_t_3 = __pyx_f_5pysam_7libcbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_t_1 = __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":3764
 * 
 *         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, 3764, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
    __pyx_t_5 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3764, __pyx_L6_error)
        #endif
        if (__pyx_t_6 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3764, __pyx_L6_error)
      #else
      __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3764, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_r, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_i, __pyx_t_3);
      __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3764, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3);
      __pyx_t_3 = __pyx_t_7;
      __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr11__pyx_v_r, (PyObject*)__pyx_9genexpr11__pyx_v_i))) __PYX_ERR(0, 3764, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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":3753
 * cdef class BCFIndex(object):
 *     """CSI index data structure for BCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3766
 *         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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3766, 0, __PYX_ERR(0, 3766, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3767
 * 
 *     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":3768
 *     def __dealloc__(self):
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    hts_idx_destroy(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3769
 *         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":3767
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             hts_idx_destroy(self.ptr)
 *             self.ptr = NULL
 */
  }

  /* "pysam/libcbcf.pyx":3766
 *         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 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.BCFIndex.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3771
 *             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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_reopen,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bcf)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 1); __PYX_ERR(0, 3771, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 2); __PYX_ERR(0, 3771, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 3); __PYX_ERR(0, 3771, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reopen)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3771, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 4); __PYX_ERR(0, 3771, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fetch") < 0)) __PYX_ERR(0, 3771, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __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, 3771, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__211)
  __Pyx_RefNannySetupContext("fetch", 1);
  __Pyx_TraceCall("fetch", __pyx_f[0], 3771, 0, __PYX_ERR(0, 3771, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3772
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
 *         return BCFIterator(bcf, contig, start, stop, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_bcf);
  __Pyx_GIVEREF(__pyx_v_bcf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bcf)) __PYX_ERR(0, 3772, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_contig)) __PYX_ERR(0, 3772, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start)) __PYX_ERR(0, 3772, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_stop)) __PYX_ERR(0, 3772, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_reopen);
  __Pyx_GIVEREF(__pyx_v_reopen);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_reopen)) __PYX_ERR(0, 3772, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pysam_7libcbcf_BCFIterator), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3771
 *             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_AddTraceback("pysam.libcbcf.BCFIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 112, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__212)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.BCFIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__213)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.BCFIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3775
 * 
 * 
 * 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeBCFIndex", 1);
  __Pyx_TraceCall("makeBCFIndex", __pyx_f[0], 3775, 0, __PYX_ERR(0, 3775, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3776
 * 
 * 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":3777
 * 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":3776
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3779
 *         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, 3779, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3780
 * 
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3780, __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, 3780, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3779
 *         return None
 * 
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3782
 *         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_ptype_5pysam_7libcbcf_BCFIndex), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3782, __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":3783
 * 
 *     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":3784
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 *     index.header = header
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
 */
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/libcbcf.pyx":3785
 *     index.header = header
 *     index.ptr = idx
 *     index.__init__()             # <<<<<<<<<<<<<<
 * 
 *     return index
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3787
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_r = __pyx_v_index;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3775
 * 
 * 
 * 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3792
 * 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_MACROS
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3792, 0, __PYX_ERR(0, 3792, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3793
 *     """Tabix index data structure for VCF files"""
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.refmap = {}
 * 
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__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_empty_tuple;

  /* "pysam/libcbcf.pyx":3794
 *     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, 3794, __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":3796
 *         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":3797
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__210, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3797, __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, 3797, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3796
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3800
 * 
 *         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":3802
 *         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_4.__pyx_n = 1;
    __pyx_t_4.free_after = 1;
    __pyx_t_3 = __pyx_f_5pysam_7libcbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_t_1 = __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":3803
 * 
 *         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, 3803, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
    __pyx_t_5 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3803, __pyx_L6_error)
        #endif
        if (__pyx_t_6 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 3803, __pyx_L6_error)
      #else
      __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3803, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_r, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_i, __pyx_t_3);
      __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3803, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3);
      __pyx_t_3 = __pyx_t_7;
      __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr12__pyx_v_r, (PyObject*)__pyx_9genexpr12__pyx_v_i))) __PYX_ERR(0, 3803, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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":3792
 * cdef class TabixIndex(BaseIndex):
 *     """Tabix index data structure for VCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __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_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3805
 *         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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3805, 0, __PYX_ERR(0, 3805, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3806
 * 
 *     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":3807
 *     def __dealloc__(self):
 *         if self.ptr:
 *             tbx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    tbx_destroy(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3808
 *         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":3806
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             tbx_destroy(self.ptr)
 *             self.ptr = NULL
 */
  }

  /* "pysam/libcbcf.pyx":3805
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.TabixIndex.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3810
 *             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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_reopen,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bcf)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3810, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3810, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 1); __PYX_ERR(0, 3810, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3810, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 2); __PYX_ERR(0, 3810, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3810, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 3); __PYX_ERR(0, 3810, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reopen)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3810, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, 4); __PYX_ERR(0, 3810, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fetch") < 0)) __PYX_ERR(0, 3810, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __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, 3810, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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(__pyx_codeobj__214)
  __Pyx_RefNannySetupContext("fetch", 1);
  __Pyx_TraceCall("fetch", __pyx_f[0], 3810, 0, __PYX_ERR(0, 3810, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3811
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
 *         return TabixIterator(bcf, contig, start, stop, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_bcf);
  __Pyx_GIVEREF(__pyx_v_bcf);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bcf)) __PYX_ERR(0, 3811, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_contig)) __PYX_ERR(0, 3811, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start)) __PYX_ERR(0, 3811, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_stop)) __PYX_ERR(0, 3811, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_reopen);
  __Pyx_GIVEREF(__pyx_v_reopen);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_reopen)) __PYX_ERR(0, 3811, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pysam_7libcbcf_TabixIterator), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3810
 *             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_AddTraceback("pysam.libcbcf.TabixIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__215)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.TabixIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__216)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.TabixIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3814
 * 
 * 
 * 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeTabixIndex", 1);
  __Pyx_TraceCall("makeTabixIndex", __pyx_f[0], 3814, 0, __PYX_ERR(0, 3814, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3815
 * 
 * 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":3816
 * 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":3815
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3818
 *         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_ptype_5pysam_7libcbcf_TabixIndex), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3818, __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":3819
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
 */
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/libcbcf.pyx":3820
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 *     index.ptr = idx
 *     index.__init__()             # <<<<<<<<<<<<<<
 * 
 *     return index
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3822
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_r = __pyx_v_index;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3814
 * 
 * 
 * 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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__217)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.BaseIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__218)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.BaseIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3837
 * # 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("_stop_BCFIterator", __pyx_f[0], 3837, 0, __PYX_ERR(0, 3837, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3838
 * # 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":3841
 * 
 *     # 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":3842
 *     # 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":3837
 * # 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 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf._stop_BCFIterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3846
 * 
 * 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_MACROS
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_reopen,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bcf)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3846, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reopen);
          if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3846, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 3846, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3846, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(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_ptype_5pysam_7libcbcf_VariantFile, 1, "bcf", 0))) __PYX_ERR(0, 3846, __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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  unsigned int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3846, 0, __PYX_ERR(0, 3846, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3847
 * 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":3848
 *     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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__219, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3848, __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, 3848, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3847
 * 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":3850
 *             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":3851
 * 
 *         if contig is None:
 *             raise ValueError('contig must be specified')             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__220, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3851, __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, 3851, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3850
 *             raise ValueError('bcf must not be None')
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('contig must be specified')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3853
 *             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_ptype_5pysam_7libcbcf_BCFIndex); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3854
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef BCFIndex index = bcf.index
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__221, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3854, __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, 3854, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3853
 *             raise ValueError('contig must be specified')
 * 
 *         if not isinstance(bcf.index, BCFIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3856
 *             raise ValueError('bcf index required')
 * 
 *         cdef BCFIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         self.bcf = bcf
 */
  if (!(likely(((((PyObject *)__pyx_v_bcf->index)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_bcf->index), __pyx_ptype_5pysam_7libcbcf_BCFIndex))))) __PYX_ERR(0, 3856, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3858
 *         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":3859
 * 
 *         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":3863
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "pysam/libcbcf.pyx":3864
 * 
 *         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, 3864, __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, 3864, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3864, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rid = __pyx_t_7;

      /* "pysam/libcbcf.pyx":3863
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L11_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":3865
 *         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_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 3865, __pyx_L8_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "pysam/libcbcf.pyx":3867
 *         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":3868
 *             # 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_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L9_except_return;
    }
    goto __pyx_L8_except_error;

    /* "pysam/libcbcf.pyx":3863
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L11_try_end:;
  }

  /* "pysam/libcbcf.pyx":3870
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3870, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3871
 * 
 *         if reopen:
 *             self.bcf = self.bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         cstart = start if start is not None else 0
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.bcf), __pyx_n_s_copy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5pysam_7libcbcf_VariantFile))))) __PYX_ERR(0, 3871, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_9);
    __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_9);
    __pyx_t_9 = 0;

    /* "pysam/libcbcf.pyx":3870
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3873
 *             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_3 = (__pyx_v_start != Py_None);
  if (__pyx_t_3) {
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3873, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_11;
  } else {
    __pyx_t_7 = 0;
  }
  __pyx_v_cstart = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3874
 * 
 *         cstart = start if start is not None else 0
 *         cstop  = stop  if stop  is not None else MAX_POS             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_3 = (__pyx_v_stop != Py_None);
  if (__pyx_t_3) {
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3874, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_11;
  } else {
    __pyx_t_7 = __pyx_v_5pysam_7libcbcf_MAX_POS;
  }
  __pyx_v_cstop = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3876
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3877
 * 
 *         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":3876
 *         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:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L17;
        }
        __pyx_L17:;
      }
  }

  /* "pysam/libcbcf.pyx":3879
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
 */
  __pyx_t_3 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3880
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    __pyx_t_3 = (errno != 0);
    if (unlikely(__pyx_t_3)) {

      /* "pysam/libcbcf.pyx":3881
 *         if not self.iter:
 *             if errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 */
      __pyx_t_9 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_9);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 3881, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8)) __PYX_ERR(0, 3881, __pyx_L1_error);
      __pyx_t_9 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 3881, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3880
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    }

    /* "pysam/libcbcf.pyx":3883
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unable_to_fetch, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_contig, __pyx_t_9, __pyx_v_stop};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 3+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3883, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 3883, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3879
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
 */
  }

  /* "pysam/libcbcf.pyx":3846
 * 
 * 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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3885
 *                 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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3885, 0, __PYX_ERR(0, 3885, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3886
 * 
 *     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":3887
 *     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":3888
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_v_self->__pyx_base.iter = NULL;

    /* "pysam/libcbcf.pyx":3886
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL
 */
  }

  /* "pysam/libcbcf.pyx":3885
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.BCFIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3890
 *             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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 1);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 3890, 0, __PYX_ERR(0, 3890, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3891
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3890
 *             self.iter = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3893
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);
  __Pyx_TraceCall("__next__", __pyx_f[0], 3893, 0, __PYX_ERR(0, 3893, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3894
 * 
 *     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":3895
 *     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":3894
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3897
 *             raise StopIteration
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":3899
 *         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":3900
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3900, __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, 3900, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3899
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3902
 *             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":3903
 * 
 *         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":3904
 *         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":3903
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3908
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3909
 * 
 *         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":3908
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "pysam/libcbcf.pyx":3911
 *             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":3912
 * 
 *         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, 3912, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3913
 *         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":3914
 *             _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":3913
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
 */
    }

    /* "pysam/libcbcf.pyx":3915
 *             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":3916
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__222, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3916, __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, 3916, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3915
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
 */
    }

    /* "pysam/libcbcf.pyx":3917
 *             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":3918
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 3918, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __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, 3918, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3917
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    }

    /* "pysam/libcbcf.pyx":3920
 *                 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_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__223, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3920, __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, 3920, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3911
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:
 */
  }

  /* "pysam/libcbcf.pyx":3922
 *                 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":3924
 *         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":3925
 * 
 *         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, 3925, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3926
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__224, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3926, __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, 3926, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3924
 *         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":3928
 *             raise ValueError('error in bcf_subset_format')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_3), __pyx_v_record)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3928, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3893
 *         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);
  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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__225)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.BCFIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__226)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.BCFIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3932
 * 
 * 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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3932, 0, __PYX_ERR(0, 3932, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3933
 * 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":3934
 *     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":3935
 *         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":3932
 * 
 * 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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3937
 *         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_MACROS
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_reopen,0};
    values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
    values[4] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bcf)) != 0)) {
          (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3937, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3937, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3937, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3937, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reopen);
          if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3937, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 3937, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 3937, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(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_ptype_5pysam_7libcbcf_VariantFile, 1, "bcf", 0))) __PYX_ERR(0, 3937, __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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  unsigned int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 3937, 0, __PYX_ERR(0, 3937, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3938
 * 
 *     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":3939
 *     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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__219, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3939, __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, 3939, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3938
 * 
 *     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":3941
 *             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_ptype_5pysam_7libcbcf_TabixIndex); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (!__pyx_t_1);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3942
 * 
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef TabixIndex index = bcf.index
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__227, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3942, __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, 3942, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3941
 *             raise ValueError('bcf must not be None')
 * 
 *         if not isinstance(bcf.index, TabixIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('tabix index required')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3944
 *             raise ValueError('tabix index required')
 * 
 *         cdef TabixIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         self.bcf = bcf
 */
  if (!(likely(((((PyObject *)__pyx_v_bcf->index)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_bcf->index), __pyx_ptype_5pysam_7libcbcf_TabixIndex))))) __PYX_ERR(0, 3944, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3946
 *         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":3947
 * 
 *         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":3951
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "pysam/libcbcf.pyx":3952
 * 
 *         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, 3952, __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, 3952, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3952, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rid = __pyx_t_7;

      /* "pysam/libcbcf.pyx":3951
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":3953
 *         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_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 3953, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "pysam/libcbcf.pyx":3955
 *         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":3956
 *             # 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_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_except_return;
    }
    goto __pyx_L7_except_error;

    /* "pysam/libcbcf.pyx":3951
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
 */
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "pysam/libcbcf.pyx":3958
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3958, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3959
 * 
 *         if reopen:
 *             self.bcf = self.bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         cstart = start if start is not None else 0
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.bcf), __pyx_n_s_copy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5pysam_7libcbcf_VariantFile))))) __PYX_ERR(0, 3959, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_9);
    __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_9);
    __pyx_t_9 = 0;

    /* "pysam/libcbcf.pyx":3958
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3961
 *             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_3 = (__pyx_v_start != Py_None);
  if (__pyx_t_3) {
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3961, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_11;
  } else {
    __pyx_t_7 = 0;
  }
  __pyx_v_cstart = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3962
 * 
 *         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_3 = (__pyx_v_stop != Py_None);
  if (__pyx_t_3) {
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3962, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_11;
  } else {
    __pyx_t_7 = __pyx_v_5pysam_7libcbcf_MAX_POS;
  }
  __pyx_v_cstop = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3964
 *         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_7 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3964, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3964, __pyx_L1_error)
  __pyx_v_self->__pyx_base.iter = tbx_itr_queryi(__pyx_v_index->ptr, __pyx_v_rid, __pyx_t_7, __pyx_t_11);

  /* "pysam/libcbcf.pyx":3966
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
 */
  __pyx_t_3 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3967
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    __pyx_t_3 = (errno != 0);
    if (unlikely(__pyx_t_3)) {

      /* "pysam/libcbcf.pyx":3968
 *         if not self.iter:
 *             if errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 */
      __pyx_t_9 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_9);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 3968, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8)) __PYX_ERR(0, 3968, __pyx_L1_error);
      __pyx_t_9 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 3968, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3967
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    }

    /* "pysam/libcbcf.pyx":3970
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unable_to_fetch, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = NULL;
      __pyx_t_10 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_contig, __pyx_t_9, __pyx_v_stop};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 3+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3970, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 3970, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3966
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
 */
  }

  /* "pysam/libcbcf.pyx":3937
 *         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;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3972
 *                 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_TraceDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3972, 0, __PYX_ERR(0, 3972, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3973
 * 
 *     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":3974
 *     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":3975
 *         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":3973
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
 */
  }

  /* "pysam/libcbcf.pyx":3977
 *             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":3978
 * 
 *         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":3977
 *             self.iter = NULL
 * 
 *         if self.line_buffer.m:             # <<<<<<<<<<<<<<
 *             free(self.line_buffer.s)
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3980
 *             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":3981
 * 
 *         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":3982
 *         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":3972
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysam.libcbcf.TabixIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* "pysam/libcbcf.pyx":3984
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 1);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 3984, 0, __PYX_ERR(0, 3984, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3985
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3984
 *         self.line_buffer.s = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3987
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);
  __Pyx_TraceCall("__next__", __pyx_f[0], 3987, 0, __PYX_ERR(0, 3987, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3988
 * 
 *     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":3989
 *     def __next__(self):
 *         if not self.iter:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
 */
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "pysam/libcbcf.pyx":3988
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  }

  /* "pysam/libcbcf.pyx":3993
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3994
 * 
 *         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":3993
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "pysam/libcbcf.pyx":3996
 *             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":3997
 * 
 *         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":3998
 *         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":3999
 *             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":4000
 *             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":3999
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
 */
    }

    /* "pysam/libcbcf.pyx":4001
 *             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":4002
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__222, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4002, __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, 4002, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4001
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
 */
    }

    /* "pysam/libcbcf.pyx":4003
 *             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":4004
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4004, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4004, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4004, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 4004, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 4004, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4004, __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, 4004, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4003
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    }

    /* "pysam/libcbcf.pyx":4006
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__223, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4006, __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, 4006, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3996
 *             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":4008
 *                 raise IOError('unable to fetch next record')
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":4010
 *         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":4011
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4011, __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, 4011, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4010
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4013
 *             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":4014
 * 
 *         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":4015
 *         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":4014
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4017
 *             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":4020
 * 
 *         # 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":4021
 *         # 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":4022
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__228, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4022, __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, 4022, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4020
 * 
 *         # FIXME: stop iteration on parse failure?
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')
 */
  }

  /* "pysam/libcbcf.pyx":4024
 *             raise ValueError('error in vcf_parse')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_3), __pyx_v_record)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4024, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3987
 *         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);
  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_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__229)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.TabixIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__230)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.TabixIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4096
 * 
 *     """
 *     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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 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_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 4096, 0, __PYX_ERR(0, 4096, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4097
 *     """
 *     def __cinit__(self, *args, **kwargs):
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, *args, **kwargs):
 */
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4096
 * 
 *     """
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4099
 *         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_MACROS
  __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_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  if (unlikely(__pyx_kwds)) {
    __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 1);
  __Pyx_TraceCall("__init__", __pyx_f[0], 4099, 0, __PYX_ERR(0, 4099, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4100
 * 
 *     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":4101
 *     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":4102
 *         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":4103
 *         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":4104
 *         self.filename       = None
 *         self.mode           = None
 *         self.threads        = 1             # <<<<<<<<<<<<<<
 *         self.index_filename = None
 *         self.is_stream      = False
 */
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__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_int_1;

  /* "pysam/libcbcf.pyx":4105
 *         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":4106
 *         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":4107
 *         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":4108
 *         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":4109
 *         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":4110
 *         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":4111
 *         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":4113
 *         self.start_offset   = -1
 * 
 *         self.open(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4113, __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, 4113, __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":4099
 *         self.htsfile = NULL
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.header         = None
 *         self.index          = None
 */

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

/* "pysam/libcbcf.pyx":4115
 *         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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 1);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 4115, 0, __PYX_ERR(0, 4115, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4116
 * 
 *     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, 4116, __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":4117
 *     def __dealloc__(self):
 *         if not self.htsfile or not self.header:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Write header if no records were written
 */
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4116
 * 
 *     def __dealloc__(self):
 *         if not self.htsfile or not self.header:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4120
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 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":4121
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4122
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret = hts_close(self.htsfile)
 */
          (void)(bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr));
        }

        /* "pysam/libcbcf.pyx":4121
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "pysam/libcbcf.pyx":4120
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 */
  }

  /* "pysam/libcbcf.pyx":4124
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 *         cdef int 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":4125
 * 
 *         cdef int ret = hts_close(self.htsfile)
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 *         self.header = self.index = None
 * 
 */
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4126
 *         cdef int ret = hts_close(self.htsfile)
 *         self.htsfile = NULL
 *         self.header = self.index = None             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
 */
  __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":4128
 *         self.header = self.index = None
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             global errno
 *             if errno == EPIPE:
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4130
 *         if ret < 0:
 *             global errno
 *             if errno == EPIPE:             # <<<<<<<<<<<<<<
 *                 errno = 0
 *             else:
 */
    __pyx_t_1 = (errno == EPIPE);
    if (likely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4131
 *             global errno
 *             if errno == EPIPE:
 *                 errno = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError(errno, force_str(strerror(errno)))
 */
      errno = 0;

      /* "pysam/libcbcf.pyx":4130
 *         if ret < 0:
 *             global errno
 *             if errno == EPIPE:             # <<<<<<<<<<<<<<
 *                 errno = 0
 *             else:
 */
      goto __pyx_L13;
    }

    /* "pysam/libcbcf.pyx":4133
 *                 errno = 0
 *             else:
 *                 raise IOError(errno, force_str(strerror(errno)))             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 4133, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 4133, __pyx_L1_error);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 4133, __pyx_L1_error)
    }
    __pyx_L13:;

    /* "pysam/libcbcf.pyx":4128
 *         self.header = self.index = None
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             global errno
 *             if errno == EPIPE:
 */
  }

  /* "pysam/libcbcf.pyx":4115
 *         self.open(*args, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if not self.htsfile or not self.header:
 *             return
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
}

/* "pysam/libcbcf.pyx":4135
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     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)\ncloses the :class:`pysam.VariantFile`.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_7close = {"close", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) 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_TraceDeclarations
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__231)
  __Pyx_RefNannySetupContext("close", 1);
  __Pyx_TraceCall("close", __pyx_f[0], 4135, 0, __PYX_ERR(0, 4135, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4137
 *     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":4138
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Write header if no records were written
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4137
 *     def close(self):
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4141
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 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":4142
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4143
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret = hts_close(self.htsfile)
 */
          (void)(bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr));
        }

        /* "pysam/libcbcf.pyx":4142
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "pysam/libcbcf.pyx":4141
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 */
  }

  /* "pysam/libcbcf.pyx":4145
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 *         cdef int 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":4146
 * 
 *         cdef int ret = hts_close(self.htsfile)
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 *         self.header = self.index = None
 * 
 */
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4147
 *         cdef int ret = hts_close(self.htsfile)
 *         self.htsfile = NULL
 *         self.header = self.index = None             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
 */
  __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":4149
 *         self.header = self.index = None
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             global errno
 *             if errno == EPIPE:
 */
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4151
 *         if ret < 0:
 *             global errno
 *             if errno == EPIPE:             # <<<<<<<<<<<<<<
 *                 errno = 0
 *             else:
 */
    __pyx_t_1 = (errno == EPIPE);
    if (likely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4152
 *             global errno
 *             if errno == EPIPE:
 *                 errno = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError(errno, force_str(strerror(errno)))
 */
      errno = 0;

      /* "pysam/libcbcf.pyx":4151
 *         if ret < 0:
 *             global errno
 *             if errno == EPIPE:             # <<<<<<<<<<<<<<
 *                 errno = 0
 *             else:
 */
      goto __pyx_L11;
    }

    /* "pysam/libcbcf.pyx":4154
 *                 errno = 0
 *             else:
 *                 raise IOError(errno, force_str(strerror(errno)))             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4154, __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)) __PYX_ERR(0, 4154, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 4154, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4154, __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, 4154, __pyx_L1_error)
    }
    __pyx_L11:;

    /* "pysam/libcbcf.pyx":4149
 *         self.header = self.index = None
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             global errno
 *             if errno == EPIPE:
 */
  }

  /* "pysam/libcbcf.pyx":4135
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4156
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     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_TraceDeclarations
  __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("__iter__", 1);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 4156, 0, __PYX_ERR(0, 4156, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4157
 * 
 *     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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4157, __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, 4157, __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":4158
 *     def __iter__(self):
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4158, __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, 4158, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4157
 * 
 *     def __iter__(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4160
 *             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":4161
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot iterate over Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__233, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4161, __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, 4161, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4160
 *             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":4163
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
 *         self.is_reading = 1             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->is_reading = 1;

  /* "pysam/libcbcf.pyx":4164
 * 
 *         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);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4156
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     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_AddTraceback("pysam.libcbcf.VariantFile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4166
 *         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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 1);
  __Pyx_TraceCall("__next__", __pyx_f[0], 4166, 0, __PYX_ERR(0, 4166, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4169
 *         cdef int ret
 *         cdef int errcode
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":4171
 *         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":4172
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4172, __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, 4172, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4171
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4174
 *             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":4175
 * 
 *         record.pos = -1
 *         if self.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  if (__pyx_v_self->drop_samples) {

    /* "pysam/libcbcf.pyx":4176
 *         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":4175
 * 
 *         record.pos = -1
 *         if self.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4178
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4179
 * 
 *         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":4178
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "pysam/libcbcf.pyx":4181
 *             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":4182
 * 
 *         if ret < 0:
 *             errcode = record.errcode             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             if errcode:
 */
    __pyx_t_3 = __pyx_v_record->errcode;
    __pyx_v_errcode = __pyx_t_3;

    /* "pysam/libcbcf.pyx":4183
 *         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":4184
 *             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":4185
 *             bcf_destroy1(record)
 *             if errcode:
 *                 raise IOError('unable to parse next record')             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__234, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4185, __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, 4185, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4184
 *             errcode = record.errcode
 *             bcf_destroy1(record)
 *             if errcode:             # <<<<<<<<<<<<<<
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:
 */
    }

    /* "pysam/libcbcf.pyx":4186
 *             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":4187
 *                 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":4186
 *             if errcode:
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
 */
    }

    /* "pysam/libcbcf.pyx":4188
 *             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":4189
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__222, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4189, __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, 4189, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4188
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
 */
    }

    /* "pysam/libcbcf.pyx":4190
 *             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":4191
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(0, 4191, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 4191, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4191, __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, 4191, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4190
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
 */
    }

    /* "pysam/libcbcf.pyx":4193
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.header, record)
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__223, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4193, __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, 4193, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":4181
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             errcode = record.errcode
 *             bcf_destroy1(record)
 */
  }

  /* "pysam/libcbcf.pyx":4195
 *                 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_5 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), __pyx_v_record)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4195, __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;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4166
 *         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_4);
  __Pyx_XDECREF(__pyx_t_5);
  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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4197
 *         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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  htsFile *__pyx_t_4;
  int64_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  unsigned int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__235)
  __Pyx_RefNannySetupContext("copy", 1);
  __Pyx_TraceCall("copy", __pyx_f[0], 4197, 0, __PYX_ERR(0, 4197, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4198
 * 
 *     def copy(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4198, __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, 4198, __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":4199
 *     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, 4199, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4198
 * 
 *     def copy(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4201
 *             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_ptype_5pysam_7libcbcf_VariantFile), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4201, __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":4205
 * 
 *         # 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 *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 4205, __pyx_L1_error)
  __pyx_v_vars->__pyx_base.htsfile = __pyx_t_4;

  /* "pysam/libcbcf.pyx":4207
 *         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":4208
 * 
 *         if not vars.htsfile:
 *             raise ValueError('Cannot re-open htsfile')             # <<<<<<<<<<<<<<
 * 
 *         # minimize overhead by re-using header and index.  This approach is
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__236, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4208, __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, 4208, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4207
 *         vars.htsfile = self._open_htsfile()
 * 
 *         if not vars.htsfile:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot re-open htsfile')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4212
 *         # 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":4213
 *         # 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":4215
 *         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":4216
 * 
 *         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":4217
 *         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":4218
 *         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":4219
 *         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":4220
 *         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":4221
 *         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":4222
 *         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":4223
 *         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_5 = __pyx_v_self->__pyx_base.start_offset;
  __pyx_v_vars->__pyx_base.start_offset = __pyx_t_5;

  /* "pysam/libcbcf.pyx":4224
 *         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":4226
 *         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":4227
 * 
 *         if self.htsfile.is_bin:
 *             vars.seek(self.tell())             # <<<<<<<<<<<<<<
 *         else:
 *             with nogil:
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vars), __pyx_n_s_seek); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_t_8 = NULL;
    __pyx_t_10 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4226
 *         vars.header_written = self.header_written
 * 
 *         if self.htsfile.is_bin:             # <<<<<<<<<<<<<<
 *             vars.seek(self.tell())
 *         else:
 */
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":4229
 *             vars.seek(self.tell())
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(vars.htsfile)
 *             makeVariantHeader(hdr)
 */
  /*else*/ {
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4230
 *         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":4229
 *             vars.seek(self.tell())
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(vars.htsfile)
 *             makeVariantHeader(hdr)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "pysam/libcbcf.pyx":4231
 *             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, 4231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":4233
 *             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);
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4197
 *         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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4235
 *         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=u'r', index_filename=None, VariantHeader header=None, drop_samples=False, duplicate_filehandle=True, ignore_truncation=False, threads=1)\nopen a vcf/bcf file.\n\n        If open is called on an existing VariantFile, the current file will be\n        closed and a new file will be opened.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_15open = {"open", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,&__pyx_n_s_index_filename,&__pyx_n_s_header,&__pyx_n_s_drop_samples,&__pyx_n_s_duplicate_filehandle,&__pyx_n_s_ignore_truncation,&__pyx_n_s_threads,0};
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_n_u_r));

    /* "pysam/libcbcf.pyx":4236
 * 
 *     def open(self, filename, mode='r',
 *              index_filename=None,             # <<<<<<<<<<<<<<
 *              VariantHeader header=None,
 *              drop_samples=False,
 */
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));

    /* "pysam/libcbcf.pyx":4237
 *     def open(self, filename, mode='r',
 *              index_filename=None,
 *              VariantHeader header=None,             # <<<<<<<<<<<<<<
 *              drop_samples=False,
 *              duplicate_filehandle=True,
 */
    values[3] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None));

    /* "pysam/libcbcf.pyx":4238
 *              index_filename=None,
 *              VariantHeader header=None,
 *              drop_samples=False,             # <<<<<<<<<<<<<<
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,
 */
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));

    /* "pysam/libcbcf.pyx":4239
 *              VariantHeader header=None,
 *              drop_samples=False,
 *              duplicate_filehandle=True,             # <<<<<<<<<<<<<<
 *              ignore_truncation=False,
 *              threads=1):
 */
    values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_True));

    /* "pysam/libcbcf.pyx":4240
 *              drop_samples=False,
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,             # <<<<<<<<<<<<<<
 *              threads=1):
 *         """open a vcf/bcf file.
 */
    values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index_filename);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_drop_samples);
          if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_duplicate_filehandle);
          if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ignore_truncation);
          if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_threads);
          if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4235, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "open") < 0)) __PYX_ERR(0, 4235, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 4235, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_ptype_5pysam_7libcbcf_VariantHeader, 1, "header", 0))) __PYX_ERR(0, 4237, __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":4235
 *         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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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;
  unsigned int __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;
  char const *__pyx_t_14;
  int __pyx_t_15;
  htsFile *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  char *__pyx_t_19;
  int64_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__237)
  __Pyx_RefNannySetupContext("open", 0);
  __Pyx_TraceCall("open", __pyx_f[0], 4235, 0, __PYX_ERR(0, 4235, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_mode);
  __Pyx_INCREF(__pyx_v_index_filename);

  /* "pysam/libcbcf.pyx":4252
 *         cdef tbx_t *tidx
 *         cdef char *cfilename
 *         cdef char *cindex_filename = NULL             # <<<<<<<<<<<<<<
 *         cdef char *cmode
 * 
 */
  __pyx_v_cindex_filename = NULL;

  /* "pysam/libcbcf.pyx":4255
 *         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_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4255, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4255, __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, 4255, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4261
 *             # 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__238, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4261, __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, 4261, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4255
 *         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":4262
 *             # 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":4265
 * 
 *         # close a previously opened file
 *         if self.is_open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4265, __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, 4265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4266
 *         # close a previously opened file
 *         if self.is_open:
 *             self.close()             # <<<<<<<<<<<<<<
 * 
 *         if not mode or mode[0] not in 'rwa':
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":4265
 * 
 *         # close a previously opened file
 *         if self.is_open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4268
 *             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, 4268, __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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_2, __pyx_n_u_rwa, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4268, __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":4269
 * 
 *         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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__239, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4269, __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, 4269, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4268
 *             self.close()
 * 
 *         if not mode or mode[0] not in 'rwa':             # <<<<<<<<<<<<<<
 *             raise ValueError('mode must begin with r, w or a')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4271
 *             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, 4271, __pyx_L1_error)
  __pyx_v_self->__pyx_base.duplicate_filehandle = __pyx_t_1;

  /* "pysam/libcbcf.pyx":4273
 *         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, 4273, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_mode, 1, 0, NULL, NULL, &__pyx_slice__240, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4273, __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, 4273, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4273, __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_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4273, __pyx_L12_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 4273, __pyx_L12_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4273, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4273, __pyx_L12_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 4273, __pyx_L12_error)
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4273, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_9(__pyx_t_5);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 4273, __pyx_L12_error)
          }
          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_n_u_bcguz, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4273, __pyx_L12_error)
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr13__pyx_v_m))) __PYX_ERR(0, 4273, __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":4274
 * 
 *         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, 4274, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_8 > 1);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4275
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_mode_contains_conflicting_format, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__12, __pyx_v_format_modes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __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, 4275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 4275, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4274
 * 
 *         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":4277
 *             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_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4277, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_mode, 1, 0, NULL, NULL, &__pyx_slice__240, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4277, __pyx_L21_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_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4277, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4277, __pyx_L21_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4277, __pyx_L21_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 4277, __pyx_L21_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4277, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4277, __pyx_L21_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 4277, __pyx_L21_error)
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4277, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 4277, __pyx_L21_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_m, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_9genexpr14__pyx_v_m, __pyx_n_u_bcguz0123456789ex, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4277, __pyx_L21_error)
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_9genexpr14__pyx_v_m))) __PYX_ERR(0, 4277, __pyx_L21_error)
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_5);
  __pyx_t_5 = 0;

  /* "pysam/libcbcf.pyx":4278
 * 
 *         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 = (PyList_GET_SIZE(__pyx_v_invalid_modes) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4279
 *         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_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_mode_options, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__12, __pyx_v_invalid_modes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4279, __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, 4279, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4278
 * 
 *         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":4282
 * 
 *         # 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_n_u_w, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4282, __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":4283
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):
 *             if filename.endswith('.gz'):             # <<<<<<<<<<<<<<
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u_gz};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4283, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4284
 *         if mode == 'w' and isinstance(filename, str):
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'             # <<<<<<<<<<<<<<
 *             elif filename.endswith('.bcf'):
 *                 mode = 'wb'
 */
      __Pyx_INCREF(__pyx_n_u_wz);
      __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_u_wz);

      /* "pysam/libcbcf.pyx":4283
 *         # 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":4285
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):             # <<<<<<<<<<<<<<
 *                 mode = 'wb'
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u_bcf_2};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4286
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):
 *                 mode = 'wb'             # <<<<<<<<<<<<<<
 * 
 *         # for htslib, wbu seems to not work
 */
      __Pyx_INCREF(__pyx_n_u_wb);
      __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_u_wb);

      /* "pysam/libcbcf.pyx":4285
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):             # <<<<<<<<<<<<<<
 *                 mode = 'wb'
 * 
 */
    }
    __pyx_L31:;

    /* "pysam/libcbcf.pyx":4282
 * 
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):             # <<<<<<<<<<<<<<
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
 */
  }

  /* "pysam/libcbcf.pyx":4289
 * 
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':             # <<<<<<<<<<<<<<
 *             mode = 'wb0'
 * 
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_n_u_wbu, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4289, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4290
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':
 *             mode = 'wb0'             # <<<<<<<<<<<<<<
 * 
 *         self.mode = mode = force_bytes(mode)
 */
    __Pyx_INCREF(__pyx_n_u_wb0);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_u_wb0);

    /* "pysam/libcbcf.pyx":4289
 * 
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':             # <<<<<<<<<<<<<<
 *             mode = 'wb0'
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4292
 *             mode = 'wb0'
 * 
 *         self.mode = mode = force_bytes(mode)             # <<<<<<<<<<<<<<
 *         try:
 *             filename = encode_filename(filename)
 */
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_mode, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.mode);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.mode);
  __pyx_v_self->__pyx_base.mode = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4293
 * 
 *         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_11, &__pyx_t_12, &__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    /*try:*/ {

      /* "pysam/libcbcf.pyx":4294
 *         self.mode = mode = force_bytes(mode)
 *         try:
 *             filename = encode_filename(filename)             # <<<<<<<<<<<<<<
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'
 */
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4294, __pyx_L33_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":4295
 *         try:
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)             # <<<<<<<<<<<<<<
 *             self.is_stream = filename == b'-'
 *         except TypeError:
 */
      __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 4295, __pyx_L33_error)
      __pyx_v_self->__pyx_base.is_remote = hisremote(__pyx_t_14);

      /* "pysam/libcbcf.pyx":4296
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'             # <<<<<<<<<<<<<<
 *         except TypeError:
 *             filename = filename
 */
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_filename, __pyx_kp_b__241, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4296, __pyx_L33_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4296, __pyx_L33_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_self->__pyx_base.is_stream = __pyx_t_1;

      /* "pysam/libcbcf.pyx":4293
 * 
 *         self.mode = mode = force_bytes(mode)
 *         try:             # <<<<<<<<<<<<<<
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
 */
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L38_try_end;
    __pyx_L33_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 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;

    /* "pysam/libcbcf.pyx":4297
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'
 *         except TypeError:             # <<<<<<<<<<<<<<
 *             filename = filename
 *             self.is_remote = False
 */
    __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_15) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 4297, __pyx_L35_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "pysam/libcbcf.pyx":4298
 *             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":4299
 *         except TypeError:
 *             filename = filename
 *             self.is_remote = False             # <<<<<<<<<<<<<<
 *             self.is_stream = True
 * 
 */
      __pyx_v_self->__pyx_base.is_remote = 0;

      /* "pysam/libcbcf.pyx":4300
 *             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_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L34_exception_handled;
    }
    goto __pyx_L35_except_error;

    /* "pysam/libcbcf.pyx":4293
 * 
 *         self.mode = mode = force_bytes(mode)
 *         try:             # <<<<<<<<<<<<<<
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
 */
    __pyx_L35_except_error:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    goto __pyx_L1_error;
    __pyx_L34_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    __pyx_L38_try_end:;
  }

  /* "pysam/libcbcf.pyx":4302
 *             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":4304
 *         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":4305
 * 
 *         if index_filename is not None:
 *             self.index_filename = index_filename = encode_filename(index_filename)             # <<<<<<<<<<<<<<
 *         else:
 *             self.index_filename = None
 */
    __pyx_t_2 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_index_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4305, __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.index_filename);
    __Pyx_DECREF(__pyx_v_self->__pyx_base.index_filename);
    __pyx_v_self->__pyx_base.index_filename = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_index_filename, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":4304
 *         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":4307
 *             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":4309
 *             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, 4309, __pyx_L1_error)
  __pyx_v_self->drop_samples = (!(!__pyx_t_1));

  /* "pysam/libcbcf.pyx":4310
 * 
 *         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":4312
 *         self.header = None
 * 
 *         self.header_written = False             # <<<<<<<<<<<<<<
 * 
 *         if mode.startswith(b'w'):
 */
  __pyx_v_self->header_written = 0;

  /* "pysam/libcbcf.pyx":4314
 *         self.header_written = False
 * 
 *         if mode.startswith(b'w'):             # <<<<<<<<<<<<<<
 *             # open file for writing
 *             if index_filename is not None:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_mode, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_b_w};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4314, __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, 4314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4316
 *         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":4317
 *             # 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__242, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4317, __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, 4317, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4316
 *         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":4320
 * 
 *             # 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, 4320, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4321
 *             # header structure (used for writing)
 *             if header:
 *                 self.header = header.copy()             # <<<<<<<<<<<<<<
 *             else:
 *                 self.header = VariantHeader()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_header), __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(0, 4321, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __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_2);
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":4320
 * 
 *             # header structure (used for writing)
 *             if header:             # <<<<<<<<<<<<<<
 *                 self.header = header.copy()
 *             else:
 */
      goto __pyx_L44;
    }

    /* "pysam/libcbcf.pyx":4323
 *                 self.header = header.copy()
 *             else:
 *                 self.header = VariantHeader()             # <<<<<<<<<<<<<<
 *                 #raise ValueError('a VariantHeader must be specified')
 * 
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __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_2);
      __pyx_t_2 = 0;
    }
    __pyx_L44:;

    /* "pysam/libcbcf.pyx":4327
 * 
 *             # Header is not written until the first write or on close
 *             self.htsfile = self._open_htsfile()             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
 */
    __pyx_t_16 = ((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_16 == ((htsFile *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 4327, __pyx_L1_error)
    __pyx_v_self->__pyx_base.htsfile = __pyx_t_16;

    /* "pysam/libcbcf.pyx":4329
 *             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":4330
 * 
 *             if not self.htsfile:
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))             # <<<<<<<<<<<<<<
 * 
 *         elif mode.startswith(b'r'):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_could_not_open_file_mode, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_filename, __pyx_v_mode};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 4330, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4329
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))
 * 
 */
    }

    /* "pysam/libcbcf.pyx":4314
 *         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":4332
 *                 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_PyObject_GetAttrStr(__pyx_v_mode, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_b_r};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4332, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4334
 *         elif mode.startswith(b'r'):
 *             # open file for reading
 *             self.htsfile = self._open_htsfile()             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
 */
    __pyx_t_16 = ((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_16 == ((htsFile *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 4334, __pyx_L1_error)
    __pyx_v_self->__pyx_base.htsfile = __pyx_t_16;

    /* "pysam/libcbcf.pyx":4336
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 if errno:
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))
 */
    __pyx_t_1 = (!(__pyx_v_self->__pyx_base.htsfile != 0));
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4337
 * 
 *             if not self.htsfile:
 *                 if errno:             # <<<<<<<<<<<<<<
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))
 *                 else:
 */
      __pyx_t_1 = (errno != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pysam/libcbcf.pyx":4338
 *             if not self.htsfile:
 *                 if errno:
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError('could not open variant file `{}`'.format(filename))
 */
        __pyx_t_5 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_could_not_open_variant_file, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_17 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_10, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 4338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_v_filename, __pyx_t_17};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4338, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5)) __PYX_ERR(0, 4338, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __PYX_ERR(0, 4338, __pyx_L1_error);
        __pyx_t_5 = 0;
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4338, __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, 4338, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":4337
 * 
 *             if not self.htsfile:
 *                 if errno:             # <<<<<<<<<<<<<<
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))
 *                 else:
 */
      }

      /* "pysam/libcbcf.pyx":4340
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))
 *                 else:
 *                     raise ValueError('could not open variant file `{}`'.format(filename))             # <<<<<<<<<<<<<<
 * 
 *             if self.htsfile.format.format not in (bcf, vcf):
 */
      /*else*/ {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_could_not_open_variant_file_2, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4340, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_filename};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4340, __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, 4340, __pyx_L1_error)
      }

      /* "pysam/libcbcf.pyx":4336
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 if errno:
 *                     raise IOError(errno, 'could not open variant file `{}`: {}'.format(filename, force_str(strerror(errno))))
 */
    }

    /* "pysam/libcbcf.pyx":4342
 *                     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":4343
 * 
 *             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_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_filename, __pyx_v_mode};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4343, __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, 4343, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4342
 *                     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":4345
 *                 raise ValueError('invalid file `{}` (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
 *             self.check_truncation(ignore_truncation)             # <<<<<<<<<<<<<<
 * 
 *             with nogil:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_truncation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_ignore_truncation};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":4347
 *             self.check_truncation(ignore_truncation)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4348
 * 
 *             with nogil:
 *                 hdr = bcf_hdr_read(self.htsfile)             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
          __pyx_v_hdr = bcf_hdr_read(__pyx_v_self->__pyx_base.htsfile);
        }

        /* "pysam/libcbcf.pyx":4347
 *             self.check_truncation(ignore_truncation)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L51;
          }
          __pyx_L51:;
        }
    }

    /* "pysam/libcbcf.pyx":4350
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4351
 * 
 *             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_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeader(__pyx_v_hdr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4351, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __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_2);
        __pyx_t_2 = 0;

        /* "pysam/libcbcf.pyx":4350
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
 */
      }
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L57_try_end;
      __pyx_L52_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 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;

      /* "pysam/libcbcf.pyx":4352
 *             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_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_15) {
        __Pyx_AddTraceback("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 4352, __pyx_L54_except_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "pysam/libcbcf.pyx":4353
 *                 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_file_does_not_have_valid_header, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4353, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_18 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_18)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_18);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_18, __pyx_v_filename, __pyx_v_mode};
          __pyx_t_17 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 4353, __pyx_L54_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4353, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_Raise(__pyx_t_10, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __PYX_ERR(0, 4353, __pyx_L54_except_error)
      }
      goto __pyx_L54_except_error;

      /* "pysam/libcbcf.pyx":4350
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
 */
      __pyx_L54_except_error:;
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L57_try_end:;
    }

    /* "pysam/libcbcf.pyx":4355
 *                 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_5 = __pyx_v_self->__pyx_base.filename;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = PyBytes_Check(__pyx_t_5); 
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "pysam/libcbcf.pyx":4356
 * 
 *             if isinstance(self.filename, bytes):
 *                 cfilename = self.filename             # <<<<<<<<<<<<<<
 *             else:
 *                 cfilename = NULL
 */
      __pyx_t_19 = __Pyx_PyObject_AsWritableString(__pyx_v_self->__pyx_base.filename); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 4356, __pyx_L1_error)
      __pyx_v_cfilename = __pyx_t_19;

      /* "pysam/libcbcf.pyx":4355
 *                 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":4358
 *                 cfilename = self.filename
 *             else:
 *                 cfilename = NULL             # <<<<<<<<<<<<<<
 * 
 *             # check for index and open if present
 */
    /*else*/ {
      __pyx_v_cfilename = NULL;
    }
    __pyx_L60:;

    /* "pysam/libcbcf.pyx":4361
 * 
 *             # 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":4362
 *             # 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":4363
 *             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_19 = __Pyx_PyObject_AsWritableString(__pyx_v_index_filename); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 4363, __pyx_L1_error)
        __pyx_v_cindex_filename = __pyx_t_19;

        /* "pysam/libcbcf.pyx":4362
 *             # 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":4364
 *                 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)
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {

            /* "pysam/libcbcf.pyx":4365
 *                     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":4364
 *                 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:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L67;
            }
            __pyx_L67:;
          }
      }

      /* "pysam/libcbcf.pyx":4366
 *                 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_5 = ((PyObject *)__pyx_v_self->header);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeBCFIndex(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5), __pyx_v_idx)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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":4361
 * 
 *             # 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":4368
 *                 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":4369
 * 
 *             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":4370
 *             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_19 = __Pyx_PyObject_AsWritableString(__pyx_v_index_filename); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 4370, __pyx_L1_error)
        __pyx_v_cindex_filename = __pyx_t_19;

        /* "pysam/libcbcf.pyx":4369
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:
 *                 if index_filename is not None:             # <<<<<<<<<<<<<<
 *                     cindex_filename = index_filename
 *                 with nogil:
 */
      }

      /* "pysam/libcbcf.pyx":4371
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)
 *                 self.index = makeTabixIndex(tidx)
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {

            /* "pysam/libcbcf.pyx":4372
 *                     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":4371
 *                 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:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L73;
            }
            __pyx_L73:;
          }
      }

      /* "pysam/libcbcf.pyx":4373
 *                 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, 4373, __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":4368
 *                 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":4375
 *                 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":4376
 * 
 *             if not self.is_stream:
 *                 self.start_offset = self.tell()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('unknown mode {}'.format(mode))
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = NULL;
      __pyx_t_6 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4376, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_t_20 = __Pyx_PyInt_As_int64_t(__pyx_t_4); if (unlikely((__pyx_t_20 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_self->__pyx_base.start_offset = __pyx_t_20;

      /* "pysam/libcbcf.pyx":4375
 *                 self.index = makeTabixIndex(tidx)
 * 
 *             if not self.is_stream:             # <<<<<<<<<<<<<<
 *                 self.start_offset = self.tell()
 *         else:
 */
    }

    /* "pysam/libcbcf.pyx":4332
 *                 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":4378
 *                 self.start_offset = self.tell()
 *         else:
 *             raise ValueError('unknown mode {}'.format(mode))             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unknown_mode, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_mode};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4378, __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, 4378, __pyx_L1_error)
  }
  __pyx_L42:;

  /* "pysam/libcbcf.pyx":4235
 *         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);
  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_17);
  __Pyx_XDECREF(__pyx_t_18);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4380
 *             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)\nreset file position to beginning of file just after the header.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_17reset = {"reset", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__243)
  __Pyx_RefNannySetupContext("reset", 1);
  __Pyx_TraceCall("reset", __pyx_f[0], 4380, 0, __PYX_ERR(0, 4380, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4382
 *     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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->__pyx_base.start_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4380
 *             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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4384
 *         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\n        return True if the numerical :term:`tid` is valid; False otherwise.\n\n        returns -1 if reference is not known.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_19is_valid_tid = {"is_valid_tid", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_tid,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tid)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4384, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_valid_tid") < 0)) __PYX_ERR(0, 4384, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 4384, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  bcf_hdr_t *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__244)
  __Pyx_RefNannySetupContext("is_valid_tid", 1);
  __Pyx_TraceCall("is_valid_tid", __pyx_f[0], 4384, 0, __PYX_ERR(0, 4384, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4390
 *         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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4390, __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, 4390, __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":4391
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4391, __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, 4391, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4390
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4393
 *             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_4 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_4;

  /* "pysam/libcbcf.pyx":4394
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid             # <<<<<<<<<<<<<<
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_tid); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
  __pyx_v_rid = __pyx_t_5;

  /* "pysam/libcbcf.pyx":4395
 *         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, 4395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4384
 *         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_AddTraceback("pysam.libcbcf.VariantFile.is_valid_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4397
 *         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\n        return the numerical :term:`tid` corresponding to\n        :term:`reference`\n\n        returns -1 if reference is not known.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_21get_tid = {"get_tid", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_reference,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reference)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4397, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_tid") < 0)) __PYX_ERR(0, 4397, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 4397, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__245)
  __Pyx_RefNannySetupContext("get_tid", 0);
  __Pyx_TraceCall("get_tid", __pyx_f[0], 4397, 0, __PYX_ERR(0, 4397, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_reference);

  /* "pysam/libcbcf.pyx":4404
 *         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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4404, __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, 4404, __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":4405
 *         """
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4405, __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, 4405, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4404
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4407
 *             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":4408
 * 
 *         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, 4408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_reference, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4409
 *         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_4 = __Pyx_PyObject_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 4409, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_4);

  /* "pysam/libcbcf.pyx":4410
 *         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_PyInt_From_int(kh_val(__pyx_v_d, __pyx_v_k).id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_t_1 = __pyx_int_neg_1;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4397
 *         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_5);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4412
 *         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\n        return :term:`reference` name corresponding to numerical :term:`tid`\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_23get_reference_name = {"get_reference_name", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_tid,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tid)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4412, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_reference_name") < 0)) __PYX_ERR(0, 4412, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 4412, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  bcf_hdr_t *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__246)
  __Pyx_RefNannySetupContext("get_reference_name", 1);
  __Pyx_TraceCall("get_reference_name", __pyx_f[0], 4412, 0, __PYX_ERR(0, 4412, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4416
 *         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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4416, __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, 4416, __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":4417
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4417, __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, 4417, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4416
 *         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":4419
 *             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_4 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_4;

  /* "pysam/libcbcf.pyx":4420
 * 
 *         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_5 = __Pyx_PyInt_As_int(__pyx_v_tid); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4420, __pyx_L1_error)
  __pyx_v_rid = __pyx_t_5;

  /* "pysam/libcbcf.pyx":4421
 *         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":4422
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__247, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4422, __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, 4422, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4421
 *         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":4423
 *         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, 4423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4412
 *         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_AddTraceback("pysam.libcbcf.VariantFile.get_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4425
 *         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)\nfetch records in a :term:`region`, specified either by\n        :term:`contig`, *start*, and *end* (which are 0-based, half-open);\n        or alternatively by a samtools :term:`region` string (which is\n        1-based inclusive).\n\n        Without *contig* or *region* all mapped records will be fetched.  The\n        records will be returned ordered by contig, which will not necessarily\n        be the order within the file.\n\n        Set *reopen* to true if you will be using multiple iterators on the\n        same file at the same time.  The iterator returned will receive its\n        own copy of a filehandle to the file effectively re-opening the\n        file.  Re-opening a file incurrs some overhead, so use with care.\n\n        If only *contig* is set, all records on *contig* will be fetched.\n        If both *region* and *contig* are given, an exception is raised.\n\n        Note 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\n        read sequentially.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_25fetch = {"fetch", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,&__pyx_n_s_end,&__pyx_n_s_reference,0};
    values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
    values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
          if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_region);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reopen);
          if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_end);
          if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reference);
          if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fetch") < 0)) __PYX_ERR(0, 4425, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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, 4425, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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;
  PyObject *__pyx_t_6 = NULL;
  unsigned int __pyx_t_7;
  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(__pyx_codeobj__248)
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceCall("fetch", __pyx_f[0], 4425, 0, __PYX_ERR(0, 4425, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_contig);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);

  /* "pysam/libcbcf.pyx":4447
 *         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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4447, __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, 4447, __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":4448
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4448, __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, 4448, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4447
 *         read sequentially.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4450
 *             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":4451
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot fetch from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if contig is None and region is None:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__249, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4451, __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, 4451, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4450
 *             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":4453
 *             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":4454
 * 
 *         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":4455
 *         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, 4455, __pyx_L1_error)
    if (__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __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":4456
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)             # <<<<<<<<<<<<<<
 *             return iter(bcf)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bcf, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int64_t(__pyx_v_self->__pyx_base.start_offset); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __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, 4456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4457
 *             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, 4457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4453
 *             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":4459
 *             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":4460
 * 
 *         if self.index is None:
 *             raise ValueError('fetch requires an index')             # <<<<<<<<<<<<<<
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__250, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4460, __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, 4460, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4459
 *             return iter(bcf)
 * 
 *         if self.index is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('fetch requires an index')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4462
 *             raise ValueError('fetch requires an index')
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,             # <<<<<<<<<<<<<<
 *                                                 None, end=end, reference=reference)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse_region); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pysam/libcbcf.pyx":4463
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,
 *                                                 None, end=end, reference=reference)             # <<<<<<<<<<<<<<
 * 
 *         if contig is None:
 */
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_contig)) __PYX_ERR(0, 4462, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_start)) __PYX_ERR(0, 4462, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_stop)) __PYX_ERR(0, 4462, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_region);
  __Pyx_GIVEREF(__pyx_v_region);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_region)) __PYX_ERR(0, 4462, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 4, Py_None)) __PYX_ERR(0, 4462, __pyx_L1_error);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_end, __pyx_v_end) < 0) __PYX_ERR(0, 4463, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reference, __pyx_v_reference) < 0) __PYX_ERR(0, 4463, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4462
 *             raise ValueError('fetch requires an index')
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,             # <<<<<<<<<<<<<<
 *                                                 None, end=end, reference=reference)
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  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 != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 4462, __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_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_4,&__pyx_t_1,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 4462, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_4,&__pyx_t_1,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __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, 4462, __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, 4462, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }
  __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_1);
  __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_8);
  __pyx_t_8 = 0;

  /* "pysam/libcbcf.pyx":4465
 *                                                 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":4466
 * 
 *         if contig is None:
 *             contig = self.get_reference_name(tid)             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_reference_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = NULL;
    __pyx_t_7 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_7 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_tid};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_contig, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":4465
 *                                                 None, end=end, reference=reference)
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             contig = self.get_reference_name(tid)
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4468
 *             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":4469
 * 
 *         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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->index), __pyx_n_s_fetch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen};
    __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4425
 *         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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4471
 *         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)\nCreate a new empty :class:`VariantRecord`.\n\n        See :meth:`VariantHeader.new_record`\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_27new_record = {"new_record", (PyCFunction)(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_MACROS
  __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);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "new_record", 1))) return NULL;
  if (unlikely(__pyx_kwds)) {
    __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_TraceDeclarations
  __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(__pyx_codeobj__251)
  __Pyx_RefNannySetupContext("new_record", 1);
  __Pyx_TraceCall("new_record", __pyx_f[0], 4471, 0, __PYX_ERR(0, 4471, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4476
 *         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_n_s_new_record); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4476, __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, 4476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4471
 *         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_AddTraceback("pysam.libcbcf.VariantFile.new_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4478
 *         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) {
  PyObject *__pyx_v_msg = NULL;
  int __pyx_v_ret;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__252)
  __Pyx_RefNannySetupContext("write", 1);
  __Pyx_TraceCall("write", __pyx_f[0], 4478, 0, __PYX_ERR(0, 4478, __pyx_L1_error));
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (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)))) {
    #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_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_5pysam_7libcbcf_11VariantFile_29write)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_record)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4478, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4478, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_6;
        __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":4484
 *         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":4485
 *         """
 *         if record is None:
 *             raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *         if not self.is_open:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4485, __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, 4485, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4484
 *         returns the number of bytes written.
 *         """
 *         if record is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('record must not be None')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4487
 *             raise ValueError('record must not be None')
 * 
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             return ValueError('I/O operation on closed file')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4487, __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, 4487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (!__pyx_t_7);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":4488
 * 
 *         if not self.is_open:
 *             return ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if not self.htsfile.is_write:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4488, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4487
 *             raise ValueError('record must not be None')
 * 
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             return ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4490
 *             return 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":4491
 * 
 *         if not self.htsfile.is_write:
 *             raise ValueError('cannot write to a Variantfile opened for reading')             # <<<<<<<<<<<<<<
 * 
 *         if not self.header_written:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__253, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4491, __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, 4491, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4490
 *             return 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":4493
 *             raise ValueError('cannot write to a Variantfile opened for reading')
 * 
 *         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":4494
 * 
 *         if not self.header_written:
 *             self.header_written = True             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 */
    __pyx_v_self->header_written = 1;

    /* "pysam/libcbcf.pyx":4495
 *         if not self.header_written:
 *             self.header_written = True
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4496
 *             self.header_written = True
 *             with nogil:
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *         #if record.header is not self.header:
 */
          (void)(bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr));
        }

        /* "pysam/libcbcf.pyx":4495
 *         if not self.header_written:
 *             self.header_written = True
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "pysam/libcbcf.pyx":4493
 *             raise ValueError('cannot write to a Variantfile opened for reading')
 * 
 *         if not self.header_written:             # <<<<<<<<<<<<<<
 *             self.header_written = True
 *             with nogil:
 */
  }

  /* "pysam/libcbcf.pyx":4502
 *         #    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":4503
 * 
 *         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_kp_u_Invalid_VariantRecord_Number_of);
    __pyx_v_msg = __pyx_kp_u_Invalid_VariantRecord_Number_of;

    /* "pysam/libcbcf.pyx":4504
 *         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 = __Pyx_PyInt_From_uint32_t(__pyx_v_record->ptr->n_sample); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_From_int32_t(bcf_hdr_nsamples(__pyx_v_self->header->ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyUnicode_Type_format, __pyx_v_msg, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4504, __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_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 4504, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4502
 *         #    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":4507
 * 
 *         # Sync END annotation before writing
 *         bcf_sync_end(record)             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
 */
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_record); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":4511
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4512
 * 
 *         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":4511
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
  }

  /* "pysam/libcbcf.pyx":4514
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise IOError(errno, strerror(errno))
 * 
 */
  __pyx_t_8 = (__pyx_v_ret < 0);
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":4515
 * 
 *         if ret < 0:
 *             raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 * 
 *         return ret
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4515, __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)) __PYX_ERR(0, 4515, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 4515, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 4515, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4514
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise IOError(errno, strerror(errno))
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4517
 *             raise IOError(errno, strerror(errno))
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def subset_samples(self, include_samples):
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4478
 *         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_AddTraceback("pysam.libcbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_TraceReturn(Py_None, 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\n        write a single :class:`pysam.VariantRecord` to disk.\n\n        returns the number of bytes written.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_29write = {"write", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_record,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4478, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 4478, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 4478, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_ptype_5pysam_7libcbcf_VariantRecord, 1, "record", 0))) __PYX_ERR(0, 4478, __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;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __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_TraceDeclarations
  __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(__pyx_codeobj__252)
  __Pyx_RefNannySetupContext("write", 1);
  __Pyx_TraceCall("write (wrapper)", __pyx_f[0], 4478, 0, __PYX_ERR(0, 4478, __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, 4478, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4478, __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_AddTraceback("pysam.libcbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4519
 *         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\n        Read only a subset of samples to reduce processing time and memory.\n        Must be called prior to retrieving records.\n        ");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_31subset_samples = {"subset_samples", (PyCFunction)(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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_include_samples,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_include_samples)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4519, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "subset_samples") < 0)) __PYX_ERR(0, 4519, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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, 4519, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __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_TraceFrameInit(__pyx_codeobj__254)
  __Pyx_RefNannySetupContext("subset_samples", 1);
  __Pyx_TraceCall("subset_samples", __pyx_f[0], 4519, 0, __PYX_ERR(0, 4519, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4524
 *         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_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4524, __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, 4524, __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":4525
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__232, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4525, __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, 4525, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4524
 *         Must be called prior to retrieving records.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4527
 *             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":4528
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if self.is_reading:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__255, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4528, __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, 4528, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4527
 *             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":4530
 *             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":4531
 * 
 *         if self.is_reading:
 *             raise ValueError('cannot subset samples after fetching records')             # <<<<<<<<<<<<<<
 * 
 *         self.header._subset_samples(include_samples)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__256, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4531, __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, 4531, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4530
 *             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":4533
 *             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, 4533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4536
 * 
 *         # 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, 4536, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":4537
 *         # 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":4536
 * 
 *         # potentially unnecessary optimization that also sets max_unpack
 *         if not include_samples:             # <<<<<<<<<<<<<<
 *             self.drop_samples = True
 * 
 */
  }

  /* "pysam/libcbcf.pyx":4519
 *         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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.subset_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 135, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 136, 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);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 138, 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;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.drop_samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 141, 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;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.is_reading.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 1);
  __Pyx_TraceCall("__get__", __pyx_f[3], 142, 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;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.header_written.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) 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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__257)
  __Pyx_RefNannySetupContext("__reduce_cython__", 1);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[4], 1, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 3, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(4, 3, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__258)
  __Pyx_RefNannySetupContext("__setstate_cython__", 1);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[4], 3, 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_kp_s_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_AddTraceback("pysam.libcbcf.VariantFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderRecords", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderRecords", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantHeaderRecords") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__259)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderRecords", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderRecords", __pyx_f[4], 1, 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_PyInt_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_tuple__260, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderRecords__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderRecords__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderRecords__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantMetadata", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantMetadata", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantMetadata") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__261)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantMetadata", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantMetadata", __pyx_f[4], 1, 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_PyInt_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_tuple__262, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantMetadata), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantMetadata__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantMetadata__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_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_n_s_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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_7); __pyx_t_7 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantMetadata__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderMetadata", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderMetadata", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantHeaderMetadata") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__263)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderMetadata", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderMetadata", __pyx_f[4], 1, 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_PyInt_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_tuple__264, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderMetadata__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderMetadata__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_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_n_s_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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_7); __pyx_t_7 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderMetadata__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantContig", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantContig", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantContig") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__265)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantContig", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantContig", __pyx_f[4], 1, 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_PyInt_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_tuple__266, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantContig), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantContig__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantContig__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_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_n_s_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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_7); __pyx_t_7 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantContig__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderContigs", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderContigs", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantHeaderContigs") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__267)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderContigs", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderContigs", __pyx_f[4], 1, 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_PyInt_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_tuple__260, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderContigs__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderContigs__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderContigs__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderSamples", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderSamples", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantHeaderSamples") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__268)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderSamples", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderSamples", __pyx_f[4], 1, 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_PyInt_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_tuple__260, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderSamples__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantHeaderSamples__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderSamples__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFilter", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFilter", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantRecordFilter") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__269)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFilter", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordFilter", __pyx_f[4], 1, 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_PyInt_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_tuple__270, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFilter__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordFilter__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFilter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFormat", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFormat", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantRecordFormat") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__271)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFormat", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordFormat", __pyx_f[4], 1, 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_PyInt_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_tuple__270, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFormat__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordFormat__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFormat__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordInfo", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordInfo", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantRecordInfo") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__272)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordInfo", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordInfo", __pyx_f[4], 1, 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_PyInt_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_tuple__270, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordInfo__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordInfo__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordInfo__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSamples", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSamples", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantRecordSamples") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__273)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSamples", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordSamples", __pyx_f[4], 1, 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_PyInt_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_tuple__270, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSamples__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordSamples__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSamples__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSample", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSample", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_VariantRecordSample") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__274)
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSample", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordSample", __pyx_f[4], 1, 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_PyInt_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_tuple__275, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSample__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_VariantRecordSample__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_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_PyInt_From_long, 0, 0, 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_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_n_s_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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_7); __pyx_t_7 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSample__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 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*)(__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_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseIndex", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseIndex", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_BaseIndex") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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 */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__276)
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseIndex", 1);
  __Pyx_TraceCall("__pyx_unpickle_BaseIndex", __pyx_f[4], 1, 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_PyInt_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_tuple__277, 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_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_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_PyInt_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 = __Pyx_PyString_Format(__pyx_kp_s_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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __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;
  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_XDECREF(__pyx_t_4);
  __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_TraceReturn(__pyx_r, 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_TraceDeclarations
  __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;
  unsigned int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseIndex__set_state", 1);
  __Pyx_TraceCall("__pyx_unpickle_BaseIndex__set_state", __pyx_f[4], 11, 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_PyInt_From_long, 0, 0, 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_PyInt_From_long, 0, 0, 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_n_s_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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    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_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __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);
  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_AddTraceback("pysam.libcbcf.__pyx_unpickle_BaseIndex__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
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_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_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 || CYTHON_COMPILING_IN_PYPY
  (*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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_8copy},
  {"merge", (PyCFunction)(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*)(__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*)(__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*)(__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*)(__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*)(__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*)(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_25add_samples, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_24add_samples},
  {"__reduce_cython__", (PyCFunction)(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*)(__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[] = {
  {(char *)"version", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_version, 0, (char *)PyDoc_STR("VCF version"), 0},
  {(char *)"samples", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_samples, 0, (char *)PyDoc_STR("samples (:class:`VariantHeaderSamples`)"), 0},
  {(char *)"records", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_records, 0, (char *)PyDoc_STR("header records (:class:`VariantHeaderRecords`)"), 0},
  {(char *)"contigs", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_contigs, 0, (char *)PyDoc_STR("contig information (:class:`VariantHeaderContigs`)"), 0},
  {(char *)"filters", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_filters, 0, (char *)PyDoc_STR("filter metadata (:class:`VariantHeaderMetadata`)"), 0},
  {(char *)"info", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_info, 0, (char *)PyDoc_STR("info metadata (:class:`VariantHeaderMetadata`)"), 0},
  {(char *)"formats", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_formats, 0, (char *)PyDoc_STR("format metadata (:class:`VariantHeaderMetadata`)"), 0},
  {(char *)"alts", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_alts, 0, (char *)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()\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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()\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_11get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_23keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_25items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_27values},
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_29update},
  {"pop", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_32pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_31pop},
  {"remove", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"type", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_type, 0, (char *)PyDoc_STR("header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"), 0},
  {(char *)"key", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_key, 0, (char *)PyDoc_STR("header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"), 0},
  {(char *)"value", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_value, 0, (char *)PyDoc_STR("header value.  Set only for generic lines, None for FILTER/INFO, etc."), 0},
  {(char *)"attrs", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_attrs, 0, (char *)PyDoc_STR("sequence of additional header attributes"), 0},
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderRecords_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__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*)(__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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_15get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_27keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_29items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_32values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_31values},
  {"add", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderContigs_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_14add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_13add},
  {"__reduce_cython__", (PyCFunction)(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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderSamples_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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*)(__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*)(__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*)(__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[] = {
  {(char *)"name", __pyx_getprop_5pysam_7libcbcf_13VariantContig_name, 0, (char *)PyDoc_STR("contig name"), 0},
  {(char *)"id", __pyx_getprop_5pysam_7libcbcf_13VariantContig_id, 0, (char *)PyDoc_STR("contig internal id number"), 0},
  {(char *)"length", __pyx_getprop_5pysam_7libcbcf_13VariantContig_length, 0, (char *)PyDoc_STR("contig length or None if not available"), 0},
  {(char *)"header_record", __pyx_getprop_5pysam_7libcbcf_13VariantContig_header_record, 0, (char *)PyDoc_STR(":class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"), 0},
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_13VariantContig_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("VariantContig(*args, **kwargs)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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*)(__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*)(__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*)(__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[] = {
  {(char *)"name", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_name, 0, (char *)PyDoc_STR("metadata name"), 0},
  {(char *)"id", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_id, 0, (char *)PyDoc_STR("metadata internal header id number"), 0},
  {(char *)"number", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_number, 0, (char *)PyDoc_STR("metadata number (i.e. cardinality)"), 0},
  {(char *)"type", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_type, 0, (char *)PyDoc_STR("metadata value type"), 0},
  {(char *)"description", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_description, 0, (char *)PyDoc_STR("metadata description (or None if not set)"), 0},
  {(char *)"record", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_record, 0, (char *)PyDoc_STR(":class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"), 0},
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("VariantMetadata(*args, **kwargs)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_2add},
  {"remove_header", (PyCFunction)(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*)(__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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_17get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_29keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_31items},
  {"values", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_21VariantHeaderMetadata_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_4copy},
  {"translate", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"rid", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_rid, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rid, (char *)PyDoc_STR("internal reference id number"), 0},
  {(char *)"chrom", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_chrom, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_chrom, (char *)PyDoc_STR("chromosome/contig name"), 0},
  {(char *)"contig", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_contig, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_contig, (char *)PyDoc_STR("chromosome/contig name"), 0},
  {(char *)"pos", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_pos, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_pos, (char *)PyDoc_STR("record start position on chrom/contig (1-based inclusive)"), 0},
  {(char *)"start", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_start, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_start, (char *)PyDoc_STR("record start position on chrom/contig (0-based inclusive)"), 0},
  {(char *)"stop", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_stop, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_stop, (char *)PyDoc_STR("record stop position on chrom/contig (0-based exclusive)"), 0},
  {(char *)"rlen", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_rlen, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rlen, (char *)PyDoc_STR("record length on chrom/contig (aka rec.stop - rec.start)"), 0},
  {(char *)"qual", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_qual, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_qual, (char *)PyDoc_STR("phred scaled quality score or None if not available"), 0},
  {(char *)"id", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_id, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_id, (char *)PyDoc_STR("record identifier or None if not available"), 0},
  {(char *)"ref", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_ref, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_ref, (char *)PyDoc_STR("reference allele"), 0},
  {(char *)"alleles", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alleles, (char *)PyDoc_STR("tuple of reference allele followed by alt alleles"), 0},
  {(char *)"alts", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alts, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alts, (char *)PyDoc_STR("tuple of alt alleles"), 0},
  {(char *)"filter", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_filter, 0, (char *)PyDoc_STR("filter information (see :class:`VariantRecordFilter`)"), 0},
  {(char *)"info", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_info, 0, (char *)PyDoc_STR("info data (see :class:`VariantRecordInfo`)"), 0},
  {(char *)"format", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_format, 0, (char *)PyDoc_STR("sample format metadata (see :class:`VariantRecordFormat`)"), 0},
  {(char *)"samples", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_samples, 0, (char *)PyDoc_STR("sample data (see :class:`VariantRecordSamples`)"), 0},
  {(char *)"alleles_variant_types", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles_variant_types, 0, (char *)0, 0},
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_header, 0, (char *)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)\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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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_GetName(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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_9add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_8add},
  {"clear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_12clear},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_17get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_23itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_26iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_29keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_31items},
  {"values", (PyCFunction)(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*)(__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*)(__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)\nFilters set on a :class:`VariantRecord` object, presented as a mapping from\n       filter 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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\nFilters set on a :class:`VariantRecord` object, presented as a mapping from\n       filter 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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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_GetName(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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_10clear},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_15get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_21itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_24iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_27keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_29items},
  {"values", (PyCFunction)(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*)(__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*)(__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)\nFormat data present for each sample in a :class:`VariantRecord` object,\n       presented 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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\nFormat data present for each sample in a :class:`VariantRecord` object,\n       presented 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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_12clear},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_17get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_23itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_26iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_29keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_31items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_33values},
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_35update},
  {"pop", (PyCFunction)(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*)(__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*)(__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)\nInfo data stored in a :class:`VariantRecord` object, presented as a\n       mapping 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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\nInfo data stored in a :class:`VariantRecord` object, presented as a\n       mapping 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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordSamples[] = {
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_11get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_17itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_20iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_23keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_25items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_27values},
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_29update},
  {"pop", (PyCFunction)(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*)(__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*)(__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)\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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_12clear},
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_17get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_21iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_23itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_26iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_29keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_31items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_33values},
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_35update},
  {"pop", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"name", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_name, 0, (char *)PyDoc_STR("sample name"), 0},
  {(char *)"allele_indices", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices, (char *)PyDoc_STR("allele indices for called genotype, if present.  Otherwise None"), 0},
  {(char *)"alleles", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_alleles, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_alleles, (char *)PyDoc_STR("alleles for called genotype, if present.  Otherwise None"), 0},
  {(char *)"phased", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_phased, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_phased, (char *)PyDoc_STR("False if genotype is missing or any allele is unphased.  Otherwise True."), 0},
  {(char *)"index", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_index, 0, (char *)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)\nData for a single sample from a :class:`VariantRecord` object.\n       Provides data accessors for genotypes and a mapping interface\n       from format name to values.\n    ")},
  {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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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)\nData for a single sample from a :class:`VariantRecord` object.\n       Provides data accessors for genotypes and a mapping interface\n       from format name to values.\n    "), /*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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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 = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_BaseIndex[] = {
  {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_11get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_10get},
  {"iterkeys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_15iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_14iterkeys},
  {"itervalues", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_17itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_16itervalues},
  {"iteritems", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_20iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_19iteritems},
  {"keys", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_23keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_22keys},
  {"items", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_25items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_24items},
  {"values", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_26values},
  {"update", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_29update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_28update},
  {"pop", (PyCFunction)(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*)(__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*)(__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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  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*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_4fetch},
  {"__reduce_cython__", (PyCFunction)(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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_8BCFIndex_header, 0, (char *)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()\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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("BCFIndex()\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_4fetch},
  {"__reduce_cython__", (PyCFunction)(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*)(__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()\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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("TabixIndex()\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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 || CYTHON_COMPILING_IN_PYPY
  (*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;
  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*)(__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*)(__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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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*)(__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*)(__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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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*)(__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*)(__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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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_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 PY_MAJOR_VERSION < 3
  if (!(__pyx_ptype_5pysam_10libchtslib_HTSFile) || PyType_IS_GC(__pyx_ptype_5pysam_10libchtslib_HTSFile)) PyObject_GC_Track(o);
  #else
  if (PyType_IS_GC(__pyx_ptype_5pysam_10libchtslib_HTSFile)) PyObject_GC_Track(o);
  #endif
  if (likely(__pyx_ptype_5pysam_10libchtslib_HTSFile)) __Pyx_PyType_GetSlot(__pyx_ptype_5pysam_10libchtslib_HTSFile, tp_dealloc, destructor)(o); else __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;
  e = ((likely(__pyx_ptype_5pysam_10libchtslib_HTSFile)) ? ((__pyx_ptype_5pysam_10libchtslib_HTSFile->tp_traverse) ? __pyx_ptype_5pysam_10libchtslib_HTSFile->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_7libcbcf_VariantFile)); 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 (likely(__pyx_ptype_5pysam_10libchtslib_HTSFile)) { if (__pyx_ptype_5pysam_10libchtslib_HTSFile->tp_clear) __pyx_ptype_5pysam_10libchtslib_HTSFile->tp_clear(o); } else __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*)(__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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_13copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_12copy},
  {"open", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_15open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_14open},
  {"reset", (PyCFunction)(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*)(__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*)(__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*)(__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*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_25fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_24fetch},
  {"new_record", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_27new_record, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_26new_record},
  {"subset_samples", (PyCFunction)(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*)(__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*)(__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[] = {
  {(char *)"header", __pyx_getprop_5pysam_7libcbcf_11VariantFile_header, 0, (char *)0, 0},
  {(char *)"index", __pyx_getprop_5pysam_7libcbcf_11VariantFile_index, 0, (char *)0, 0},
  {(char *)"drop_samples", __pyx_getprop_5pysam_7libcbcf_11VariantFile_drop_samples, 0, (char *)0, 0},
  {(char *)"is_reading", __pyx_getprop_5pysam_7libcbcf_11VariantFile_is_reading, 0, (char *)0, 0},
  {(char *)"header_written", __pyx_getprop_5pysam_7libcbcf_11VariantFile_header_written, 0, (char *)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*(filename, mode=None, index_filename=None, header=None, drop_samples=False,\n    duplicate_filehandle=True, ignore_truncation=False, threads=1)*\n\n    A :term:`VCF`/:term:`BCF` formatted file. The file is automatically\n    opened.\n\n    If an index for a variant file exists (.csi or .tbi), it will be\n    opened automatically.  Without an index random access to records\n    via :meth:`fetch` is disabled.\n\n    For writing, a :class:`VariantHeader` object must be provided,\n    typically obtained from another :term:`VCF` file/:term:`BCF`\n    file.\n\n    Parameters\n    ----------\n    mode : 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\n    index_filename : string\n        Explicit path to an index file.\n\n    header : VariantHeader\n        :class:`VariantHeader` object required for writing.\n\n    drop_samples: bool\n        Ignore sample information when reading.\n\n    duplicate_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        hig""h-level python object. Set to False to turn off\n        duplication.\n\n    ignore_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\n    threads: 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)\n\n    ")},
  {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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("VariantFile(*args, **kwargs)\n*(filename, mode=None, index_filename=None, header=None, drop_samples=False,\n    duplicate_filehandle=True, ignore_truncation=False, threads=1)*\n\n    A :term:`VCF`/:term:`BCF` formatted file. The file is automatically\n    opened.\n\n    If an index for a variant file exists (.csi or .tbi), it will be\n    opened automatically.  Without an index random access to records\n    via :meth:`fetch` is disabled.\n\n    For writing, a :class:`VariantHeader` object must be provided,\n    typically obtained from another :term:`VCF` file/:term:`BCF`\n    file.\n\n    Parameters\n    ----------\n    mode : 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\n    index_filename : string\n        Explicit path to an index file.\n\n    header : VariantHeader\n        :class:`VariantHeader` object required for writing.\n\n    drop_samples: bool\n        Ignore sample information when reading.\n\n    duplicate_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        hig""h-level python object. Set to False to turn off\n        duplication.\n\n    ignore_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\n    threads: 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)\n\n    "), /*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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static 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];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple[__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 || CYTHON_COMPILING_IN_PYPY
    (*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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__ = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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

#if CYTHON_USE_FREELISTS
static struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[8];
static int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems = 0;
#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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[--__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_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_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[__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 || CYTHON_COMPILING_IN_PYPY
    (*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;
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_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 PY_VERSION_HEX >= 0x030400a1
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #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}
};
#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
/* #### Code section: pystring_table ### */

static int __Pyx_CreateStringTabAndInitStrings(void) {
  __Pyx_StringTabEntry __pyx_string_tab[] = {
    {&__pyx_n_u_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 1, 0, 1},
    {&__pyx_n_u_ALT, __pyx_k_ALT, sizeof(__pyx_k_ALT), 0, 1, 0, 1},
    {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
    {&__pyx_n_s_BCFIndex, __pyx_k_BCFIndex, sizeof(__pyx_k_BCFIndex), 0, 0, 1, 1},
    {&__pyx_n_u_BCFIndex, __pyx_k_BCFIndex, sizeof(__pyx_k_BCFIndex), 0, 1, 0, 1},
    {&__pyx_n_s_BCFIndex___reduce_cython, __pyx_k_BCFIndex___reduce_cython, sizeof(__pyx_k_BCFIndex___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BCFIndex___setstate_cython, __pyx_k_BCFIndex___setstate_cython, sizeof(__pyx_k_BCFIndex___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BCFIndex_fetch, __pyx_k_BCFIndex_fetch, sizeof(__pyx_k_BCFIndex_fetch), 0, 0, 1, 1},
    {&__pyx_n_s_BCFIterator, __pyx_k_BCFIterator, sizeof(__pyx_k_BCFIterator), 0, 0, 1, 1},
    {&__pyx_n_u_BCFIterator, __pyx_k_BCFIterator, sizeof(__pyx_k_BCFIterator), 0, 1, 0, 1},
    {&__pyx_n_s_BCFIterator___reduce_cython, __pyx_k_BCFIterator___reduce_cython, sizeof(__pyx_k_BCFIterator___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BCFIterator___setstate_cython, __pyx_k_BCFIterator___setstate_cython, sizeof(__pyx_k_BCFIterator___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_u_BND, __pyx_k_BND, sizeof(__pyx_k_BND), 0, 1, 0, 1},
    {&__pyx_n_s_BaseIndex, __pyx_k_BaseIndex, sizeof(__pyx_k_BaseIndex), 0, 0, 1, 1},
    {&__pyx_n_u_BaseIndex, __pyx_k_BaseIndex, sizeof(__pyx_k_BaseIndex), 0, 1, 0, 1},
    {&__pyx_n_s_BaseIndex___reduce_cython, __pyx_k_BaseIndex___reduce_cython, sizeof(__pyx_k_BaseIndex___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex___setstate_cython, __pyx_k_BaseIndex___setstate_cython, sizeof(__pyx_k_BaseIndex___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_get, __pyx_k_BaseIndex_get, sizeof(__pyx_k_BaseIndex_get), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_items, __pyx_k_BaseIndex_items, sizeof(__pyx_k_BaseIndex_items), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_iteritems, __pyx_k_BaseIndex_iteritems, sizeof(__pyx_k_BaseIndex_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_iterkeys, __pyx_k_BaseIndex_iterkeys, sizeof(__pyx_k_BaseIndex_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_itervalues, __pyx_k_BaseIndex_itervalues, sizeof(__pyx_k_BaseIndex_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_keys, __pyx_k_BaseIndex_keys, sizeof(__pyx_k_BaseIndex_keys), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_pop, __pyx_k_BaseIndex_pop, sizeof(__pyx_k_BaseIndex_pop), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_update, __pyx_k_BaseIndex_update, sizeof(__pyx_k_BaseIndex_update), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIndex_values, __pyx_k_BaseIndex_values, sizeof(__pyx_k_BaseIndex_values), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIterator, __pyx_k_BaseIterator, sizeof(__pyx_k_BaseIterator), 0, 0, 1, 1},
    {&__pyx_n_u_BaseIterator, __pyx_k_BaseIterator, sizeof(__pyx_k_BaseIterator), 0, 1, 0, 1},
    {&__pyx_n_s_BaseIterator___reduce_cython, __pyx_k_BaseIterator___reduce_cython, sizeof(__pyx_k_BaseIterator___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_BaseIterator___setstate_cython, __pyx_k_BaseIterator___setstate_cython, sizeof(__pyx_k_BaseIterator___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_u_CONTIG, __pyx_k_CONTIG, sizeof(__pyx_k_CONTIG), 0, 1, 0, 1},
    {&__pyx_kp_u_Cannot_add_extra_threads_when_ig, __pyx_k_Cannot_add_extra_threads_when_ig, sizeof(__pyx_k_Cannot_add_extra_threads_when_ig), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_copy_arrays_with_src_valu, __pyx_k_Cannot_copy_arrays_with_src_valu, sizeof(__pyx_k_Cannot_copy_arrays_with_src_valu), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_create_empty_array, __pyx_k_Cannot_create_empty_array, sizeof(__pyx_k_Cannot_create_empty_array), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_re_open_htsfile, __pyx_k_Cannot_re_open_htsfile, sizeof(__pyx_k_Cannot_re_open_htsfile), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_set_phased_before_genotyp, __pyx_k_Cannot_set_phased_before_genotyp, sizeof(__pyx_k_Cannot_set_phased_before_genotyp), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_specify_an_index_filename, __pyx_k_Cannot_specify_an_index_filename, sizeof(__pyx_k_Cannot_specify_an_index_filename), 0, 1, 0, 0},
    {&__pyx_kp_u_Cannot_translate_record_Number_o, __pyx_k_Cannot_translate_record_Number_o, sizeof(__pyx_k_Cannot_translate_record_Number_o), 0, 1, 0, 0},
    {&__pyx_n_u_Description, __pyx_k_Description, sizeof(__pyx_k_Description), 0, 1, 0, 1},
    {&__pyx_kp_u_Duplicated_sample_name, __pyx_k_Duplicated_sample_name, sizeof(__pyx_k_Duplicated_sample_name), 0, 1, 0, 0},
    {&__pyx_n_b_END, __pyx_k_END, sizeof(__pyx_k_END), 0, 0, 0, 1},
    {&__pyx_n_u_END, __pyx_k_END, sizeof(__pyx_k_END), 0, 1, 0, 1},
    {&__pyx_kp_u_END_is_a_reserved_attribute_acce, __pyx_k_END_is_a_reserved_attribute_acce, sizeof(__pyx_k_END_is_a_reserved_attribute_acce), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_extracting_ID, __pyx_k_Error_extracting_ID, sizeof(__pyx_k_Error_extracting_ID), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_s_reading_record, __pyx_k_Error_s_reading_record, sizeof(__pyx_k_Error_s_reading_record), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_unpacking_VariantRecord, __pyx_k_Error_unpacking_VariantRecord, sizeof(__pyx_k_Error_unpacking_VariantRecord), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_updating_alleles, __pyx_k_Error_updating_alleles, sizeof(__pyx_k_Error_updating_alleles), 0, 1, 0, 0},
    {&__pyx_kp_u_Error_updating_id, __pyx_k_Error_updating_id, sizeof(__pyx_k_Error_updating_id), 0, 1, 0, 0},
    {&__pyx_n_u_FILTER, __pyx_k_FILTER, sizeof(__pyx_k_FILTER), 0, 1, 0, 1},
    {&__pyx_n_u_FIXED, __pyx_k_FIXED, sizeof(__pyx_k_FIXED), 0, 1, 0, 1},
    {&__pyx_n_u_FORMAT, __pyx_k_FORMAT, sizeof(__pyx_k_FORMAT), 0, 1, 0, 1},
    {&__pyx_n_u_Flag, __pyx_k_Flag, sizeof(__pyx_k_Flag), 0, 1, 0, 1},
    {&__pyx_kp_u_Flag_types_are_not_allowed_on_FO, __pyx_k_Flag_types_are_not_allowed_on_FO, sizeof(__pyx_k_Flag_types_are_not_allowed_on_FO), 0, 1, 0, 0},
    {&__pyx_kp_u_Flag_values_must_be_True_False_N, __pyx_k_Flag_values_must_be_True_False_N, sizeof(__pyx_k_Flag_values_must_be_True_False_N), 0, 1, 0, 0},
    {&__pyx_n_u_Float, __pyx_k_Float, sizeof(__pyx_k_Float), 0, 1, 0, 1},
    {&__pyx_n_u_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 1, 0, 1},
    {&__pyx_n_u_GENERIC, __pyx_k_GENERIC, sizeof(__pyx_k_GENERIC), 0, 1, 0, 1},
    {&__pyx_n_u_GT, __pyx_k_GT, sizeof(__pyx_k_GT), 0, 1, 0, 1},
    {&__pyx_kp_u_Header_already_exists_for_contig, __pyx_k_Header_already_exists_for_contig, sizeof(__pyx_k_Header_already_exists_for_contig), 0, 1, 0, 0},
    {&__pyx_kp_u_Header_already_exists_for_id, __pyx_k_Header_already_exists_for_id, sizeof(__pyx_k_Header_already_exists_for_id), 0, 1, 0, 0},
    {&__pyx_n_u_ID, __pyx_k_ID, sizeof(__pyx_k_ID), 0, 1, 0, 1},
    {&__pyx_n_u_INDEL, __pyx_k_INDEL, sizeof(__pyx_k_INDEL), 0, 1, 0, 1},
    {&__pyx_n_u_INFO, __pyx_k_INFO, sizeof(__pyx_k_INFO), 0, 1, 0, 1},
    {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
    {&__pyx_kp_u_I_O_operation_on_closed_file, __pyx_k_I_O_operation_on_closed_file, sizeof(__pyx_k_I_O_operation_on_closed_file), 0, 1, 0, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_k_Incompatible_checksums_0x_x_vs_0_2, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_2), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_3, __pyx_k_Incompatible_checksums_0x_x_vs_0_3, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_3), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_4, __pyx_k_Incompatible_checksums_0x_x_vs_0_4, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_4), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_5, __pyx_k_Incompatible_checksums_0x_x_vs_0_5, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_5), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_6, __pyx_k_Incompatible_checksums_0x_x_vs_0_6, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_6), 0, 0, 1, 0},
    {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_7, __pyx_k_Incompatible_checksums_0x_x_vs_0_7, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_7), 0, 0, 1, 0},
    {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
    {&__pyx_n_u_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 1, 0, 1},
    {&__pyx_kp_u_Integer_value_too_small_large_to, __pyx_k_Integer_value_too_small_large_to, sizeof(__pyx_k_Integer_value_too_small_large_to), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_INFO_field, __pyx_k_Invalid_INFO_field, sizeof(__pyx_k_Invalid_INFO_field), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_VariantRecord_Number_of, __pyx_k_Invalid_VariantRecord_Number_of, sizeof(__pyx_k_Invalid_VariantRecord_Number_of), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_allele_index, __pyx_k_Invalid_allele_index, sizeof(__pyx_k_Invalid_allele_index), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_chromosome_contig, __pyx_k_Invalid_chromosome_contig, sizeof(__pyx_k_Invalid_chromosome_contig), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_filter, __pyx_k_Invalid_filter, sizeof(__pyx_k_Invalid_filter), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_header, __pyx_k_Invalid_header, sizeof(__pyx_k_Invalid_header), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_header_id, __pyx_k_Invalid_header_id, sizeof(__pyx_k_Invalid_header_id), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_header_record_index, __pyx_k_Invalid_header_record_index, sizeof(__pyx_k_Invalid_header_record_index), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_index_object, __pyx_k_Invalid_index_object, sizeof(__pyx_k_Invalid_index_object), 0, 1, 0, 0},
    {&__pyx_kp_u_Invalid_tid, __pyx_k_Invalid_tid, sizeof(__pyx_k_Invalid_tid), 0, 1, 0, 0},
    {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
    {&__pyx_n_u_MNP, __pyx_k_MNP, sizeof(__pyx_k_MNP), 0, 1, 0, 1},
    {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
    {&__pyx_kp_u_NON_REF, __pyx_k_NON_REF, sizeof(__pyx_k_NON_REF), 0, 1, 0, 0},
    {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
    {&__pyx_n_u_Number, __pyx_k_Number, sizeof(__pyx_k_Number), 0, 1, 0, 1},
    {&__pyx_kp_u_Number_must_be_None_when_adding, __pyx_k_Number_must_be_None_when_adding, sizeof(__pyx_k_Number_must_be_None_when_adding), 0, 1, 0, 0},
    {&__pyx_n_u_OTHER, __pyx_k_OTHER, sizeof(__pyx_k_OTHER), 0, 1, 0, 1},
    {&__pyx_n_u_OVERLAP, __pyx_k_OVERLAP, sizeof(__pyx_k_OVERLAP), 0, 1, 0, 1},
    {&__pyx_kp_u_One_or_more_of_the_supplied_samp, __pyx_k_One_or_more_of_the_supplied_samp, sizeof(__pyx_k_One_or_more_of_the_supplied_samp), 0, 1, 0, 0},
    {&__pyx_n_u_PASS, __pyx_k_PASS, sizeof(__pyx_k_PASS), 0, 1, 0, 1},
    {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
    {&__pyx_kp_u_Position_must_be_positive, __pyx_k_Position_must_be_positive, sizeof(__pyx_k_Position_must_be_positive), 0, 1, 0, 0},
    {&__pyx_n_u_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 1, 0, 1},
    {&__pyx_n_u_REF, __pyx_k_REF, sizeof(__pyx_k_REF), 0, 1, 0, 1},
    {&__pyx_n_u_SNP, __pyx_k_SNP, sizeof(__pyx_k_SNP), 0, 1, 0, 1},
    {&__pyx_n_u_STRUCTURED, __pyx_k_STRUCTURED, sizeof(__pyx_k_STRUCTURED), 0, 1, 0, 1},
    {&__pyx_kp_u_Start_coordinate_must_be_non_neg, __pyx_k_Start_coordinate_must_be_non_neg, sizeof(__pyx_k_Start_coordinate_must_be_non_neg), 0, 1, 0, 0},
    {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
    {&__pyx_kp_u_Stop_coordinate_must_be_non_nega, __pyx_k_Stop_coordinate_must_be_non_nega, sizeof(__pyx_k_Stop_coordinate_must_be_non_nega), 0, 1, 0, 0},
    {&__pyx_kp_u_Stop_position_of_the_interval, __pyx_k_Stop_position_of_the_interval, sizeof(__pyx_k_Stop_position_of_the_interval), 0, 1, 0, 0},
    {&__pyx_n_u_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 1, 0, 1},
    {&__pyx_n_s_TabixIndex, __pyx_k_TabixIndex, sizeof(__pyx_k_TabixIndex), 0, 0, 1, 1},
    {&__pyx_n_u_TabixIndex, __pyx_k_TabixIndex, sizeof(__pyx_k_TabixIndex), 0, 1, 0, 1},
    {&__pyx_n_s_TabixIndex___reduce_cython, __pyx_k_TabixIndex___reduce_cython, sizeof(__pyx_k_TabixIndex___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_TabixIndex___setstate_cython, __pyx_k_TabixIndex___setstate_cython, sizeof(__pyx_k_TabixIndex___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_TabixIndex_fetch, __pyx_k_TabixIndex_fetch, sizeof(__pyx_k_TabixIndex_fetch), 0, 0, 1, 1},
    {&__pyx_n_s_TabixIterator, __pyx_k_TabixIterator, sizeof(__pyx_k_TabixIterator), 0, 0, 1, 1},
    {&__pyx_n_u_TabixIterator, __pyx_k_TabixIterator, sizeof(__pyx_k_TabixIterator), 0, 1, 0, 1},
    {&__pyx_n_s_TabixIterator___reduce_cython, __pyx_k_TabixIterator___reduce_cython, sizeof(__pyx_k_TabixIterator___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_TabixIterator___setstate_cython, __pyx_k_TabixIterator___setstate_cython, sizeof(__pyx_k_TabixIterator___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_u_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 1, 0, 1},
    {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
    {&__pyx_kp_u_Type_must_be_None_when_adding_a, __pyx_k_Type_must_be_None_when_adding_a, sizeof(__pyx_k_Type_must_be_None_when_adding_a), 0, 1, 0, 0},
    {&__pyx_kp_u_Unable_to_delete_END, __pyx_k_Unable_to_delete_END, sizeof(__pyx_k_Unable_to_delete_END), 0, 1, 0, 0},
    {&__pyx_kp_u_Unable_to_delete_FORMAT, __pyx_k_Unable_to_delete_FORMAT, sizeof(__pyx_k_Unable_to_delete_FORMAT), 0, 1, 0, 0},
    {&__pyx_kp_u_Unable_to_delete_INFO, __pyx_k_Unable_to_delete_INFO, sizeof(__pyx_k_Unable_to_delete_INFO), 0, 1, 0, 0},
    {&__pyx_kp_u_Unable_to_update_INFO_values, __pyx_k_Unable_to_update_INFO_values, sizeof(__pyx_k_Unable_to_update_INFO_values), 0, 1, 0, 0},
    {&__pyx_kp_u_Unable_to_update_format_values, __pyx_k_Unable_to_update_format_values, sizeof(__pyx_k_Unable_to_update_format_values), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_INFO_field, __pyx_k_Unknown_INFO_field, sizeof(__pyx_k_Unknown_INFO_field), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_allele, __pyx_k_Unknown_allele, sizeof(__pyx_k_Unknown_allele), 0, 1, 0, 0},
    {&__pyx_kp_u_Unknown_format_length, __pyx_k_Unknown_format_length, sizeof(__pyx_k_Unknown_format_length), 0, 1, 0, 0},
    {&__pyx_kp_u_Unsupported_FORMAT_type, __pyx_k_Unsupported_FORMAT_type, sizeof(__pyx_k_Unsupported_FORMAT_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Unsupported_INFO_type, __pyx_k_Unsupported_INFO_type, sizeof(__pyx_k_Unsupported_INFO_type), 0, 1, 0, 0},
    {&__pyx_kp_u_Use_allele_indices_to_set_intege, __pyx_k_Use_allele_indices_to_set_intege, sizeof(__pyx_k_Use_allele_indices_to_set_intege), 0, 1, 0, 0},
    {&__pyx_n_u_VARIABLE, __pyx_k_VARIABLE, sizeof(__pyx_k_VARIABLE), 0, 1, 0, 1},
    {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
    {&__pyx_n_s_VariantContig, __pyx_k_VariantContig, sizeof(__pyx_k_VariantContig), 0, 0, 1, 1},
    {&__pyx_n_u_VariantContig, __pyx_k_VariantContig, sizeof(__pyx_k_VariantContig), 0, 1, 0, 1},
    {&__pyx_n_s_VariantContig___reduce_cython, __pyx_k_VariantContig___reduce_cython, sizeof(__pyx_k_VariantContig___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantContig___setstate_cython, __pyx_k_VariantContig___setstate_cython, sizeof(__pyx_k_VariantContig___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantContig_remove_header, __pyx_k_VariantContig_remove_header, sizeof(__pyx_k_VariantContig_remove_header), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile, __pyx_k_VariantFile, sizeof(__pyx_k_VariantFile), 0, 0, 1, 1},
    {&__pyx_n_u_VariantFile, __pyx_k_VariantFile, sizeof(__pyx_k_VariantFile), 0, 1, 0, 1},
    {&__pyx_n_s_VariantFile___reduce_cython, __pyx_k_VariantFile___reduce_cython, sizeof(__pyx_k_VariantFile___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile___setstate_cython, __pyx_k_VariantFile___setstate_cython, sizeof(__pyx_k_VariantFile___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_close, __pyx_k_VariantFile_close, sizeof(__pyx_k_VariantFile_close), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_copy, __pyx_k_VariantFile_copy, sizeof(__pyx_k_VariantFile_copy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_fetch, __pyx_k_VariantFile_fetch, sizeof(__pyx_k_VariantFile_fetch), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_get_reference_name, __pyx_k_VariantFile_get_reference_name, sizeof(__pyx_k_VariantFile_get_reference_name), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_get_tid, __pyx_k_VariantFile_get_tid, sizeof(__pyx_k_VariantFile_get_tid), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_is_valid_tid, __pyx_k_VariantFile_is_valid_tid, sizeof(__pyx_k_VariantFile_is_valid_tid), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_new_record, __pyx_k_VariantFile_new_record, sizeof(__pyx_k_VariantFile_new_record), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_open, __pyx_k_VariantFile_open, sizeof(__pyx_k_VariantFile_open), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_reset, __pyx_k_VariantFile_reset, sizeof(__pyx_k_VariantFile_reset), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_subset_samples, __pyx_k_VariantFile_subset_samples, sizeof(__pyx_k_VariantFile_subset_samples), 0, 0, 1, 1},
    {&__pyx_n_s_VariantFile_write, __pyx_k_VariantFile_write, sizeof(__pyx_k_VariantFile_write), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader, __pyx_k_VariantHeader, sizeof(__pyx_k_VariantHeader), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeader, __pyx_k_VariantHeader, sizeof(__pyx_k_VariantHeader), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderContigs, __pyx_k_VariantHeaderContigs, sizeof(__pyx_k_VariantHeaderContigs), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeaderContigs, __pyx_k_VariantHeaderContigs, sizeof(__pyx_k_VariantHeaderContigs), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderContigs___iter, __pyx_k_VariantHeaderContigs___iter, sizeof(__pyx_k_VariantHeaderContigs___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs___reduce_cy, __pyx_k_VariantHeaderContigs___reduce_cy, sizeof(__pyx_k_VariantHeaderContigs___reduce_cy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs___setstate, __pyx_k_VariantHeaderContigs___setstate, sizeof(__pyx_k_VariantHeaderContigs___setstate), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_add, __pyx_k_VariantHeaderContigs_add, sizeof(__pyx_k_VariantHeaderContigs_add), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_clear_heade, __pyx_k_VariantHeaderContigs_clear_heade, sizeof(__pyx_k_VariantHeaderContigs_clear_heade), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_get, __pyx_k_VariantHeaderContigs_get, sizeof(__pyx_k_VariantHeaderContigs_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_items, __pyx_k_VariantHeaderContigs_items, sizeof(__pyx_k_VariantHeaderContigs_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_iteritems, __pyx_k_VariantHeaderContigs_iteritems, sizeof(__pyx_k_VariantHeaderContigs_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_iterkeys, __pyx_k_VariantHeaderContigs_iterkeys, sizeof(__pyx_k_VariantHeaderContigs_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_itervalues, __pyx_k_VariantHeaderContigs_itervalues, sizeof(__pyx_k_VariantHeaderContigs_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_keys, __pyx_k_VariantHeaderContigs_keys, sizeof(__pyx_k_VariantHeaderContigs_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_remove_head, __pyx_k_VariantHeaderContigs_remove_head, sizeof(__pyx_k_VariantHeaderContigs_remove_head), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderContigs_values, __pyx_k_VariantHeaderContigs_values, sizeof(__pyx_k_VariantHeaderContigs_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata, __pyx_k_VariantHeaderMetadata, sizeof(__pyx_k_VariantHeaderMetadata), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeaderMetadata, __pyx_k_VariantHeaderMetadata, sizeof(__pyx_k_VariantHeaderMetadata), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderMetadata___iter, __pyx_k_VariantHeaderMetadata___iter, sizeof(__pyx_k_VariantHeaderMetadata___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata___reduce_c, __pyx_k_VariantHeaderMetadata___reduce_c, sizeof(__pyx_k_VariantHeaderMetadata___reduce_c), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata___setstate, __pyx_k_VariantHeaderMetadata___setstate, sizeof(__pyx_k_VariantHeaderMetadata___setstate), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_add, __pyx_k_VariantHeaderMetadata_add, sizeof(__pyx_k_VariantHeaderMetadata_add), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_clear_head, __pyx_k_VariantHeaderMetadata_clear_head, sizeof(__pyx_k_VariantHeaderMetadata_clear_head), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_get, __pyx_k_VariantHeaderMetadata_get, sizeof(__pyx_k_VariantHeaderMetadata_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_items, __pyx_k_VariantHeaderMetadata_items, sizeof(__pyx_k_VariantHeaderMetadata_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_iteritems, __pyx_k_VariantHeaderMetadata_iteritems, sizeof(__pyx_k_VariantHeaderMetadata_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_iterkeys, __pyx_k_VariantHeaderMetadata_iterkeys, sizeof(__pyx_k_VariantHeaderMetadata_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_itervalues, __pyx_k_VariantHeaderMetadata_itervalues, sizeof(__pyx_k_VariantHeaderMetadata_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_keys, __pyx_k_VariantHeaderMetadata_keys, sizeof(__pyx_k_VariantHeaderMetadata_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_remove_hea, __pyx_k_VariantHeaderMetadata_remove_hea, sizeof(__pyx_k_VariantHeaderMetadata_remove_hea), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderMetadata_values, __pyx_k_VariantHeaderMetadata_values, sizeof(__pyx_k_VariantHeaderMetadata_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord, __pyx_k_VariantHeaderRecord, sizeof(__pyx_k_VariantHeaderRecord), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeaderRecord, __pyx_k_VariantHeaderRecord, sizeof(__pyx_k_VariantHeaderRecord), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderRecord___get___loca, __pyx_k_VariantHeaderRecord___get___loca, sizeof(__pyx_k_VariantHeaderRecord___get___loca), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord___iter, __pyx_k_VariantHeaderRecord___iter, sizeof(__pyx_k_VariantHeaderRecord___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord___reduce_cyt, __pyx_k_VariantHeaderRecord___reduce_cyt, sizeof(__pyx_k_VariantHeaderRecord___reduce_cyt), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord___setstate_c, __pyx_k_VariantHeaderRecord___setstate_c, sizeof(__pyx_k_VariantHeaderRecord___setstate_c), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_get, __pyx_k_VariantHeaderRecord_get, sizeof(__pyx_k_VariantHeaderRecord_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_items, __pyx_k_VariantHeaderRecord_items, sizeof(__pyx_k_VariantHeaderRecord_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_iteritems, __pyx_k_VariantHeaderRecord_iteritems, sizeof(__pyx_k_VariantHeaderRecord_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_iterkeys, __pyx_k_VariantHeaderRecord_iterkeys, sizeof(__pyx_k_VariantHeaderRecord_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_itervalues, __pyx_k_VariantHeaderRecord_itervalues, sizeof(__pyx_k_VariantHeaderRecord_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_keys, __pyx_k_VariantHeaderRecord_keys, sizeof(__pyx_k_VariantHeaderRecord_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_pop, __pyx_k_VariantHeaderRecord_pop, sizeof(__pyx_k_VariantHeaderRecord_pop), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_remove, __pyx_k_VariantHeaderRecord_remove, sizeof(__pyx_k_VariantHeaderRecord_remove), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_update, __pyx_k_VariantHeaderRecord_update, sizeof(__pyx_k_VariantHeaderRecord_update), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecord_values, __pyx_k_VariantHeaderRecord_values, sizeof(__pyx_k_VariantHeaderRecord_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecords, __pyx_k_VariantHeaderRecords, sizeof(__pyx_k_VariantHeaderRecords), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeaderRecords, __pyx_k_VariantHeaderRecords, sizeof(__pyx_k_VariantHeaderRecords), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderRecords___iter, __pyx_k_VariantHeaderRecords___iter, sizeof(__pyx_k_VariantHeaderRecords___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecords___reduce_cy, __pyx_k_VariantHeaderRecords___reduce_cy, sizeof(__pyx_k_VariantHeaderRecords___reduce_cy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderRecords___setstate, __pyx_k_VariantHeaderRecords___setstate, sizeof(__pyx_k_VariantHeaderRecords___setstate), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderSamples, __pyx_k_VariantHeaderSamples, sizeof(__pyx_k_VariantHeaderSamples), 0, 0, 1, 1},
    {&__pyx_n_u_VariantHeaderSamples, __pyx_k_VariantHeaderSamples, sizeof(__pyx_k_VariantHeaderSamples), 0, 1, 0, 1},
    {&__pyx_n_s_VariantHeaderSamples___iter, __pyx_k_VariantHeaderSamples___iter, sizeof(__pyx_k_VariantHeaderSamples___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderSamples___reduce_cy, __pyx_k_VariantHeaderSamples___reduce_cy, sizeof(__pyx_k_VariantHeaderSamples___reduce_cy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderSamples___setstate, __pyx_k_VariantHeaderSamples___setstate, sizeof(__pyx_k_VariantHeaderSamples___setstate), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeaderSamples_add, __pyx_k_VariantHeaderSamples_add, sizeof(__pyx_k_VariantHeaderSamples_add), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader___reduce_cython, __pyx_k_VariantHeader___reduce_cython, sizeof(__pyx_k_VariantHeader___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader___setstate_cython, __pyx_k_VariantHeader___setstate_cython, sizeof(__pyx_k_VariantHeader___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_add_line, __pyx_k_VariantHeader_add_line, sizeof(__pyx_k_VariantHeader_add_line), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_add_meta, __pyx_k_VariantHeader_add_meta, sizeof(__pyx_k_VariantHeader_add_meta), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_add_record, __pyx_k_VariantHeader_add_record, sizeof(__pyx_k_VariantHeader_add_record), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_add_sample, __pyx_k_VariantHeader_add_sample, sizeof(__pyx_k_VariantHeader_add_sample), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_add_samples, __pyx_k_VariantHeader_add_samples, sizeof(__pyx_k_VariantHeader_add_samples), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_copy, __pyx_k_VariantHeader_copy, sizeof(__pyx_k_VariantHeader_copy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_merge, __pyx_k_VariantHeader_merge, sizeof(__pyx_k_VariantHeader_merge), 0, 0, 1, 1},
    {&__pyx_n_s_VariantHeader_new_record, __pyx_k_VariantHeader_new_record, sizeof(__pyx_k_VariantHeader_new_record), 0, 0, 1, 1},
    {&__pyx_n_s_VariantMetadata, __pyx_k_VariantMetadata, sizeof(__pyx_k_VariantMetadata), 0, 0, 1, 1},
    {&__pyx_n_u_VariantMetadata, __pyx_k_VariantMetadata, sizeof(__pyx_k_VariantMetadata), 0, 1, 0, 1},
    {&__pyx_n_s_VariantMetadata___reduce_cython, __pyx_k_VariantMetadata___reduce_cython, sizeof(__pyx_k_VariantMetadata___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantMetadata___setstate_cytho, __pyx_k_VariantMetadata___setstate_cytho, sizeof(__pyx_k_VariantMetadata___setstate_cytho), 0, 0, 1, 1},
    {&__pyx_n_s_VariantMetadata_remove_header, __pyx_k_VariantMetadata_remove_header, sizeof(__pyx_k_VariantMetadata_remove_header), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecord, __pyx_k_VariantRecord, sizeof(__pyx_k_VariantRecord), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecord, __pyx_k_VariantRecord, sizeof(__pyx_k_VariantRecord), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordFilter, __pyx_k_VariantRecordFilter, sizeof(__pyx_k_VariantRecordFilter), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecordFilter, __pyx_k_VariantRecordFilter, sizeof(__pyx_k_VariantRecordFilter), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordFilter___iter, __pyx_k_VariantRecordFilter___iter, sizeof(__pyx_k_VariantRecordFilter___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter___reduce_cyt, __pyx_k_VariantRecordFilter___reduce_cyt, sizeof(__pyx_k_VariantRecordFilter___reduce_cyt), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter___setstate_c, __pyx_k_VariantRecordFilter___setstate_c, sizeof(__pyx_k_VariantRecordFilter___setstate_c), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_add, __pyx_k_VariantRecordFilter_add, sizeof(__pyx_k_VariantRecordFilter_add), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_clear, __pyx_k_VariantRecordFilter_clear, sizeof(__pyx_k_VariantRecordFilter_clear), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_get, __pyx_k_VariantRecordFilter_get, sizeof(__pyx_k_VariantRecordFilter_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_items, __pyx_k_VariantRecordFilter_items, sizeof(__pyx_k_VariantRecordFilter_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_iteritems, __pyx_k_VariantRecordFilter_iteritems, sizeof(__pyx_k_VariantRecordFilter_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_iterkeys, __pyx_k_VariantRecordFilter_iterkeys, sizeof(__pyx_k_VariantRecordFilter_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_itervalues, __pyx_k_VariantRecordFilter_itervalues, sizeof(__pyx_k_VariantRecordFilter_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_keys, __pyx_k_VariantRecordFilter_keys, sizeof(__pyx_k_VariantRecordFilter_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFilter_values, __pyx_k_VariantRecordFilter_values, sizeof(__pyx_k_VariantRecordFilter_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat, __pyx_k_VariantRecordFormat, sizeof(__pyx_k_VariantRecordFormat), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecordFormat, __pyx_k_VariantRecordFormat, sizeof(__pyx_k_VariantRecordFormat), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordFormat___iter, __pyx_k_VariantRecordFormat___iter, sizeof(__pyx_k_VariantRecordFormat___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat___reduce_cyt, __pyx_k_VariantRecordFormat___reduce_cyt, sizeof(__pyx_k_VariantRecordFormat___reduce_cyt), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat___setstate_c, __pyx_k_VariantRecordFormat___setstate_c, sizeof(__pyx_k_VariantRecordFormat___setstate_c), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_clear, __pyx_k_VariantRecordFormat_clear, sizeof(__pyx_k_VariantRecordFormat_clear), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_get, __pyx_k_VariantRecordFormat_get, sizeof(__pyx_k_VariantRecordFormat_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_items, __pyx_k_VariantRecordFormat_items, sizeof(__pyx_k_VariantRecordFormat_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_iteritems, __pyx_k_VariantRecordFormat_iteritems, sizeof(__pyx_k_VariantRecordFormat_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_iterkeys, __pyx_k_VariantRecordFormat_iterkeys, sizeof(__pyx_k_VariantRecordFormat_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_itervalues, __pyx_k_VariantRecordFormat_itervalues, sizeof(__pyx_k_VariantRecordFormat_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_keys, __pyx_k_VariantRecordFormat_keys, sizeof(__pyx_k_VariantRecordFormat_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordFormat_values, __pyx_k_VariantRecordFormat_values, sizeof(__pyx_k_VariantRecordFormat_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo, __pyx_k_VariantRecordInfo, sizeof(__pyx_k_VariantRecordInfo), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecordInfo, __pyx_k_VariantRecordInfo, sizeof(__pyx_k_VariantRecordInfo), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordInfo___iter, __pyx_k_VariantRecordInfo___iter, sizeof(__pyx_k_VariantRecordInfo___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo___reduce_cytho, __pyx_k_VariantRecordInfo___reduce_cytho, sizeof(__pyx_k_VariantRecordInfo___reduce_cytho), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo___setstate_cyt, __pyx_k_VariantRecordInfo___setstate_cyt, sizeof(__pyx_k_VariantRecordInfo___setstate_cyt), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_clear, __pyx_k_VariantRecordInfo_clear, sizeof(__pyx_k_VariantRecordInfo_clear), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_get, __pyx_k_VariantRecordInfo_get, sizeof(__pyx_k_VariantRecordInfo_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_items, __pyx_k_VariantRecordInfo_items, sizeof(__pyx_k_VariantRecordInfo_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_iteritems, __pyx_k_VariantRecordInfo_iteritems, sizeof(__pyx_k_VariantRecordInfo_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_iterkeys, __pyx_k_VariantRecordInfo_iterkeys, sizeof(__pyx_k_VariantRecordInfo_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_itervalues, __pyx_k_VariantRecordInfo_itervalues, sizeof(__pyx_k_VariantRecordInfo_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_keys, __pyx_k_VariantRecordInfo_keys, sizeof(__pyx_k_VariantRecordInfo_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_pop, __pyx_k_VariantRecordInfo_pop, sizeof(__pyx_k_VariantRecordInfo_pop), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_update, __pyx_k_VariantRecordInfo_update, sizeof(__pyx_k_VariantRecordInfo_update), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordInfo_values, __pyx_k_VariantRecordInfo_values, sizeof(__pyx_k_VariantRecordInfo_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample, __pyx_k_VariantRecordSample, sizeof(__pyx_k_VariantRecordSample), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecordSample, __pyx_k_VariantRecordSample, sizeof(__pyx_k_VariantRecordSample), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordSample___iter, __pyx_k_VariantRecordSample___iter, sizeof(__pyx_k_VariantRecordSample___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample___reduce_cyt, __pyx_k_VariantRecordSample___reduce_cyt, sizeof(__pyx_k_VariantRecordSample___reduce_cyt), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample___set___loca, __pyx_k_VariantRecordSample___set___loca, sizeof(__pyx_k_VariantRecordSample___set___loca), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample___setstate_c, __pyx_k_VariantRecordSample___setstate_c, sizeof(__pyx_k_VariantRecordSample___setstate_c), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_clear, __pyx_k_VariantRecordSample_clear, sizeof(__pyx_k_VariantRecordSample_clear), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_get, __pyx_k_VariantRecordSample_get, sizeof(__pyx_k_VariantRecordSample_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_items, __pyx_k_VariantRecordSample_items, sizeof(__pyx_k_VariantRecordSample_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_iteritems, __pyx_k_VariantRecordSample_iteritems, sizeof(__pyx_k_VariantRecordSample_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_iterkeys, __pyx_k_VariantRecordSample_iterkeys, sizeof(__pyx_k_VariantRecordSample_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_itervalues, __pyx_k_VariantRecordSample_itervalues, sizeof(__pyx_k_VariantRecordSample_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_keys, __pyx_k_VariantRecordSample_keys, sizeof(__pyx_k_VariantRecordSample_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_pop, __pyx_k_VariantRecordSample_pop, sizeof(__pyx_k_VariantRecordSample_pop), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_update, __pyx_k_VariantRecordSample_update, sizeof(__pyx_k_VariantRecordSample_update), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSample_values, __pyx_k_VariantRecordSample_values, sizeof(__pyx_k_VariantRecordSample_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples, __pyx_k_VariantRecordSamples, sizeof(__pyx_k_VariantRecordSamples), 0, 0, 1, 1},
    {&__pyx_n_u_VariantRecordSamples, __pyx_k_VariantRecordSamples, sizeof(__pyx_k_VariantRecordSamples), 0, 1, 0, 1},
    {&__pyx_n_s_VariantRecordSamples___iter, __pyx_k_VariantRecordSamples___iter, sizeof(__pyx_k_VariantRecordSamples___iter), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples___reduce_cy, __pyx_k_VariantRecordSamples___reduce_cy, sizeof(__pyx_k_VariantRecordSamples___reduce_cy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples___setstate, __pyx_k_VariantRecordSamples___setstate, sizeof(__pyx_k_VariantRecordSamples___setstate), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_get, __pyx_k_VariantRecordSamples_get, sizeof(__pyx_k_VariantRecordSamples_get), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_items, __pyx_k_VariantRecordSamples_items, sizeof(__pyx_k_VariantRecordSamples_items), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_iteritems, __pyx_k_VariantRecordSamples_iteritems, sizeof(__pyx_k_VariantRecordSamples_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_iterkeys, __pyx_k_VariantRecordSamples_iterkeys, sizeof(__pyx_k_VariantRecordSamples_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_itervalues, __pyx_k_VariantRecordSamples_itervalues, sizeof(__pyx_k_VariantRecordSamples_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_keys, __pyx_k_VariantRecordSamples_keys, sizeof(__pyx_k_VariantRecordSamples_keys), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_pop, __pyx_k_VariantRecordSamples_pop, sizeof(__pyx_k_VariantRecordSamples_pop), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_update, __pyx_k_VariantRecordSamples_update, sizeof(__pyx_k_VariantRecordSamples_update), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecordSamples_values, __pyx_k_VariantRecordSamples_values, sizeof(__pyx_k_VariantRecordSamples_values), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecord___reduce_cython, __pyx_k_VariantRecord___reduce_cython, sizeof(__pyx_k_VariantRecord___reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecord___setstate_cython, __pyx_k_VariantRecord___setstate_cython, sizeof(__pyx_k_VariantRecord___setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecord_copy, __pyx_k_VariantRecord_copy, sizeof(__pyx_k_VariantRecord_copy), 0, 0, 1, 1},
    {&__pyx_n_s_VariantRecord_translate, __pyx_k_VariantRecord_translate, sizeof(__pyx_k_VariantRecord_translate), 0, 0, 1, 1},
    {&__pyx_kp_b__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 0, 0},
    {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
    {&__pyx_kp_u__181, __pyx_k__181, sizeof(__pyx_k__181), 0, 1, 0, 0},
    {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0},
    {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
    {&__pyx_kp_b__241, __pyx_k__241, sizeof(__pyx_k__241), 0, 0, 0, 0},
    {&__pyx_n_s__278, __pyx_k__278, sizeof(__pyx_k__278), 0, 0, 1, 1},
    {&__pyx_n_s__323, __pyx_k__323, sizeof(__pyx_k__323), 0, 0, 1, 1},
    {&__pyx_n_s__330, __pyx_k__330, sizeof(__pyx_k__330), 0, 0, 1, 1},
    {&__pyx_kp_b__52, __pyx_k__52, sizeof(__pyx_k__52), 0, 0, 0, 0},
    {&__pyx_kp_u__52, __pyx_k__52, sizeof(__pyx_k__52), 0, 1, 0, 0},
    {&__pyx_kp_u__53, __pyx_k__53, sizeof(__pyx_k__53), 0, 1, 0, 0},
    {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
    {&__pyx_n_s_add_line, __pyx_k_add_line, sizeof(__pyx_k_add_line), 0, 0, 1, 1},
    {&__pyx_n_s_add_meta, __pyx_k_add_meta, sizeof(__pyx_k_add_meta), 0, 0, 1, 1},
    {&__pyx_n_s_add_record, __pyx_k_add_record, sizeof(__pyx_k_add_record), 0, 0, 1, 1},
    {&__pyx_n_s_add_sample, __pyx_k_add_sample, sizeof(__pyx_k_add_sample), 0, 0, 1, 1},
    {&__pyx_n_s_add_samples, __pyx_k_add_samples, sizeof(__pyx_k_add_samples), 0, 0, 1, 1},
    {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
    {&__pyx_n_s_alleles, __pyx_k_alleles, sizeof(__pyx_k_alleles), 0, 0, 1, 1},
    {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
    {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
    {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
    {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
    {&__pyx_n_s_bcf, __pyx_k_bcf, sizeof(__pyx_k_bcf), 0, 0, 1, 1},
    {&__pyx_kp_u_bcf_2, __pyx_k_bcf_2, sizeof(__pyx_k_bcf_2), 0, 1, 0, 0},
    {&__pyx_n_s_bcf_array_to_object_locals_genex, __pyx_k_bcf_array_to_object_locals_genex, sizeof(__pyx_k_bcf_array_to_object_locals_genex), 0, 0, 1, 1},
    {&__pyx_n_s_bcf_check_values_locals_genexpr, __pyx_k_bcf_check_values_locals_genexpr, sizeof(__pyx_k_bcf_check_values_locals_genexpr), 0, 0, 1, 1},
    {&__pyx_kp_u_bcf_hdr_format_failed, __pyx_k_bcf_hdr_format_failed, sizeof(__pyx_k_bcf_hdr_format_failed), 0, 1, 0, 0},
    {&__pyx_kp_u_bcf_hdr_set_samples_failed_ret, __pyx_k_bcf_hdr_set_samples_failed_ret, sizeof(__pyx_k_bcf_hdr_set_samples_failed_ret), 0, 1, 0, 0},
    {&__pyx_kp_u_bcf_index_required, __pyx_k_bcf_index_required, sizeof(__pyx_k_bcf_index_required), 0, 1, 0, 0},
    {&__pyx_kp_u_bcf_must_not_be_None, __pyx_k_bcf_must_not_be_None, sizeof(__pyx_k_bcf_must_not_be_None), 0, 1, 0, 0},
    {&__pyx_n_s_bcf_object_to_array_locals_genex, __pyx_k_bcf_object_to_array_locals_genex, sizeof(__pyx_k_bcf_object_to_array_locals_genex), 0, 0, 1, 1},
    {&__pyx_n_u_bcguz, __pyx_k_bcguz, sizeof(__pyx_k_bcguz), 0, 1, 0, 1},
    {&__pyx_n_u_bcguz0123456789ex, __pyx_k_bcguz0123456789ex, sizeof(__pyx_k_bcguz0123456789ex), 0, 1, 0, 1},
    {&__pyx_n_s_bgzfp, __pyx_k_bgzfp, sizeof(__pyx_k_bgzfp), 0, 0, 1, 1},
    {&__pyx_n_s_bkey, __pyx_k_bkey, sizeof(__pyx_k_bkey), 0, 0, 1, 1},
    {&__pyx_n_s_bline, __pyx_k_bline, sizeof(__pyx_k_bline), 0, 0, 1, 1},
    {&__pyx_kp_u_cannot_convert_deleted_record_to, __pyx_k_cannot_convert_deleted_record_to, sizeof(__pyx_k_cannot_convert_deleted_record_to), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_create_VariantHeader, __pyx_k_cannot_create_VariantHeader, sizeof(__pyx_k_cannot_create_VariantHeader), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_create_VariantRecord, __pyx_k_cannot_create_VariantRecord, sizeof(__pyx_k_cannot_create_VariantRecord), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_create_VariantRecordSampl, __pyx_k_cannot_create_VariantRecordSampl, sizeof(__pyx_k_cannot_create_VariantRecordSampl), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_fetch_from_Variantfile_op, __pyx_k_cannot_fetch_from_Variantfile_op, sizeof(__pyx_k_cannot_fetch_from_Variantfile_op), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_find_metadata_key, __pyx_k_cannot_find_metadata_key, sizeof(__pyx_k_cannot_find_metadata_key), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_iterate_over_Variantfile, __pyx_k_cannot_iterate_over_Variantfile, sizeof(__pyx_k_cannot_iterate_over_Variantfile), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_set_null_allele, __pyx_k_cannot_set_null_allele, sizeof(__pyx_k_cannot_set_null_allele), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_set_null_alt_allele, __pyx_k_cannot_set_null_alt_allele, sizeof(__pyx_k_cannot_set_null_alt_allele), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_subset_samples_after_fetc, __pyx_k_cannot_subset_samples_after_fetc, sizeof(__pyx_k_cannot_subset_samples_after_fetc), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_subset_samples_from_Varia, __pyx_k_cannot_subset_samples_from_Varia, sizeof(__pyx_k_cannot_subset_samples_from_Varia), 0, 1, 0, 0},
    {&__pyx_kp_u_cannot_write_to_a_Variantfile_op, __pyx_k_cannot_write_to_a_Variantfile_op, sizeof(__pyx_k_cannot_write_to_a_Variantfile_op), 0, 1, 0, 0},
    {&__pyx_n_s_cfilename, __pyx_k_cfilename, sizeof(__pyx_k_cfilename), 0, 0, 1, 1},
    {&__pyx_n_s_char_array_to_tuple_locals_genex, __pyx_k_char_array_to_tuple_locals_genex, sizeof(__pyx_k_char_array_to_tuple_locals_genex), 0, 0, 1, 1},
    {&__pyx_n_s_check_truncation, __pyx_k_check_truncation, sizeof(__pyx_k_check_truncation), 0, 0, 1, 1},
    {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
    {&__pyx_n_s_cindex_filename, __pyx_k_cindex_filename, sizeof(__pyx_k_cindex_filename), 0, 0, 1, 1},
    {&__pyx_n_s_ckey, __pyx_k_ckey, sizeof(__pyx_k_ckey), 0, 0, 1, 1},
    {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
    {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
    {&__pyx_n_s_clear_header, __pyx_k_clear_header, sizeof(__pyx_k_clear_header), 0, 0, 1, 1},
    {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
    {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
    {&__pyx_n_s_cmode, __pyx_k_cmode, sizeof(__pyx_k_cmode), 0, 0, 1, 1},
    {&__pyx_n_s_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 0, 1, 1},
    {&__pyx_n_u_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 1, 0, 1},
    {&__pyx_kp_u_contig_must_be_specified, __pyx_k_contig_must_be_specified, sizeof(__pyx_k_contig_must_be_specified), 0, 1, 0, 0},
    {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
    {&__pyx_kp_u_could_not_open_file_mode, __pyx_k_could_not_open_file_mode, sizeof(__pyx_k_could_not_open_file_mode), 0, 1, 0, 0},
    {&__pyx_kp_u_could_not_open_variant_file, __pyx_k_could_not_open_variant_file, sizeof(__pyx_k_could_not_open_variant_file), 0, 1, 0, 0},
    {&__pyx_kp_u_could_not_open_variant_file_2, __pyx_k_could_not_open_variant_file_2, sizeof(__pyx_k_could_not_open_variant_file_2), 0, 1, 0, 0},
    {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
    {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
    {&__pyx_n_s_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 0, 1, 1},
    {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
    {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
    {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
    {&__pyx_n_s_drop_samples, __pyx_k_drop_samples, sizeof(__pyx_k_drop_samples), 0, 0, 1, 1},
    {&__pyx_n_s_dst_hdr, __pyx_k_dst_hdr, sizeof(__pyx_k_dst_hdr), 0, 0, 1, 1},
    {&__pyx_n_s_dst_header, __pyx_k_dst_header, sizeof(__pyx_k_dst_header), 0, 0, 1, 1},
    {&__pyx_kp_u_dst_header_must_not_be_None, __pyx_k_dst_header_must_not_be_None, sizeof(__pyx_k_dst_header_must_not_be_None), 0, 1, 0, 0},
    {&__pyx_n_s_duplicate_filehandle, __pyx_k_duplicate_filehandle, sizeof(__pyx_k_duplicate_filehandle), 0, 0, 1, 1},
    {&__pyx_kp_u_either_value_or_items_must_be_sp, __pyx_k_either_value_or_items_must_be_sp, sizeof(__pyx_k_either_value_or_items_must_be_sp), 0, 1, 0, 0},
    {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
    {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
    {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
    {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
    {&__pyx_kp_u_error_in_bcf_subset_format, __pyx_k_error_in_bcf_subset_format, sizeof(__pyx_k_error_in_bcf_subset_format), 0, 1, 0, 0},
    {&__pyx_kp_u_error_in_vcf_parse, __pyx_k_error_in_vcf_parse, sizeof(__pyx_k_error_in_vcf_parse), 0, 1, 0, 0},
    {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
    {&__pyx_n_s_fetch, __pyx_k_fetch, sizeof(__pyx_k_fetch), 0, 0, 1, 1},
    {&__pyx_kp_u_fetch_requires_an_index, __pyx_k_fetch_requires_an_index, sizeof(__pyx_k_fetch_requires_an_index), 0, 1, 0, 0},
    {&__pyx_kp_u_file_does_not_have_valid_header, __pyx_k_file_does_not_have_valid_header, sizeof(__pyx_k_file_does_not_have_valid_header), 0, 1, 0, 0},
    {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
    {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
    {&__pyx_n_s_fmt, __pyx_k_fmt, sizeof(__pyx_k_fmt), 0, 0, 1, 1},
    {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
    {&__pyx_n_s_format_modes, __pyx_k_format_modes, sizeof(__pyx_k_format_modes), 0, 0, 1, 1},
    {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
    {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
    {&__pyx_kp_u_genotype_is_only_valid_as_a_form, __pyx_k_genotype_is_only_valid_as_a_form, sizeof(__pyx_k_genotype_is_only_valid_as_a_form), 0, 1, 0, 0},
    {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
    {&__pyx_n_s_get_reference_name, __pyx_k_get_reference_name, sizeof(__pyx_k_get_reference_name), 0, 0, 1, 1},
    {&__pyx_n_s_get_tid, __pyx_k_get_tid, sizeof(__pyx_k_get_tid), 0, 0, 1, 1},
    {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
    {&__pyx_kp_u_gz, __pyx_k_gz, sizeof(__pyx_k_gz), 0, 1, 0, 0},
    {&__pyx_n_s_hash, __pyx_k_hash, sizeof(__pyx_k_hash), 0, 0, 1, 1},
    {&__pyx_n_s_hdr, __pyx_k_hdr, sizeof(__pyx_k_hdr), 0, 0, 1, 1},
    {&__pyx_n_s_header, __pyx_k_header, sizeof(__pyx_k_header), 0, 0, 1, 1},
    {&__pyx_kp_u_header_must_not_be_None, __pyx_k_header_must_not_be_None, sizeof(__pyx_k_header_must_not_be_None), 0, 1, 0, 0},
    {&__pyx_n_s_hrec, __pyx_k_hrec, sizeof(__pyx_k_hrec), 0, 0, 1, 1},
    {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
    {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
    {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
    {&__pyx_n_s_ignore_truncation, __pyx_k_ignore_truncation, sizeof(__pyx_k_ignore_truncation), 0, 0, 1, 1},
    {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
    {&__pyx_n_s_include_samples, __pyx_k_include_samples, sizeof(__pyx_k_include_samples), 0, 0, 1, 1},
    {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
    {&__pyx_n_s_index_filename, __pyx_k_index_filename, sizeof(__pyx_k_index_filename), 0, 0, 1, 1},
    {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
    {&__pyx_n_s_info_id, __pyx_k_info_id, sizeof(__pyx_k_info_id), 0, 0, 1, 1},
    {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
    {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
    {&__pyx_kp_u_invalid_FORMAT, __pyx_k_invalid_FORMAT, sizeof(__pyx_k_invalid_FORMAT), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_VariantHeader, __pyx_k_invalid_VariantHeader, sizeof(__pyx_k_invalid_VariantHeader), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_VariantRecord, __pyx_k_invalid_VariantRecord, sizeof(__pyx_k_invalid_VariantRecord), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_character_found, __pyx_k_invalid_character_found, sizeof(__pyx_k_invalid_character_found), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_contig, __pyx_k_invalid_contig, sizeof(__pyx_k_invalid_contig), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_contig_2, __pyx_k_invalid_contig_2, sizeof(__pyx_k_invalid_contig_2), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_contig_id, __pyx_k_invalid_contig_id, sizeof(__pyx_k_invalid_contig_id), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_contig_index, __pyx_k_invalid_contig_index, sizeof(__pyx_k_invalid_contig_index), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF, __pyx_k_invalid_file_mode_is_it_VCF_BCF, sizeof(__pyx_k_invalid_file_mode_is_it_VCF_BCF), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_filter_index, __pyx_k_invalid_filter_index, sizeof(__pyx_k_invalid_filter_index), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_header_line, __pyx_k_invalid_header_line, sizeof(__pyx_k_invalid_header_line), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_header_record_index, __pyx_k_invalid_header_record_index, sizeof(__pyx_k_invalid_header_record_index), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_key, __pyx_k_invalid_key, sizeof(__pyx_k_invalid_key), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_metadata_id, __pyx_k_invalid_metadata_id, sizeof(__pyx_k_invalid_metadata_id), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_metadata_type, __pyx_k_invalid_metadata_type, sizeof(__pyx_k_invalid_metadata_type), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_mode_options, __pyx_k_invalid_mode_options, sizeof(__pyx_k_invalid_mode_options), 0, 1, 0, 0},
    {&__pyx_n_s_invalid_modes, __pyx_k_invalid_modes, sizeof(__pyx_k_invalid_modes), 0, 0, 1, 1},
    {&__pyx_kp_u_invalid_number_of_columns, __pyx_k_invalid_number_of_columns, sizeof(__pyx_k_invalid_number_of_columns), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_reference_id, __pyx_k_invalid_reference_id, sizeof(__pyx_k_invalid_reference_id), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_sample_index, __pyx_k_invalid_sample_index, sizeof(__pyx_k_invalid_sample_index), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_sample_name, __pyx_k_invalid_sample_name, sizeof(__pyx_k_invalid_sample_name), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_tag, __pyx_k_invalid_tag, sizeof(__pyx_k_invalid_tag), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_value_for_Float_format, __pyx_k_invalid_value_for_Float_format, sizeof(__pyx_k_invalid_value_for_Float_format), 0, 1, 0, 0},
    {&__pyx_kp_u_invalid_value_for_Integer_format, __pyx_k_invalid_value_for_Integer_format, sizeof(__pyx_k_invalid_value_for_Integer_format), 0, 1, 0, 0},
    {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
    {&__pyx_n_s_is_open, __pyx_k_is_open, sizeof(__pyx_k_is_open), 0, 0, 1, 1},
    {&__pyx_n_s_is_valid_tid, __pyx_k_is_valid_tid, sizeof(__pyx_k_is_valid_tid), 0, 0, 1, 1},
    {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
    {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
    {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
    {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
    {&__pyx_n_s_iterkeys, __pyx_k_iterkeys, sizeof(__pyx_k_iterkeys), 0, 0, 1, 1},
    {&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 0, 1, 1},
    {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
    {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
    {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
    {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
    {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
    {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
    {&__pyx_n_u_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 1, 0, 1},
    {&__pyx_kp_u_limits_violated, __pyx_k_limits_violated, sizeof(__pyx_k_limits_violated), 0, 1, 0, 0},
    {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
    {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
    {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
    {&__pyx_n_s_merge, __pyx_k_merge, sizeof(__pyx_k_merge), 0, 0, 1, 1},
    {&__pyx_kp_u_missing_d_requested_samples, __pyx_k_missing_d_requested_samples, sizeof(__pyx_k_missing_d_requested_samples), 0, 1, 0, 0},
    {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
    {&__pyx_kp_u_mode_contains_conflicting_format, __pyx_k_mode_contains_conflicting_format, sizeof(__pyx_k_mode_contains_conflicting_format), 0, 1, 0, 0},
    {&__pyx_kp_u_mode_must_begin_with_r_w_or_a, __pyx_k_mode_must_begin_with_r_w_or_a, sizeof(__pyx_k_mode_must_begin_with_r_w_or_a), 0, 1, 0, 0},
    {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
    {&__pyx_kp_u_must_set_at_least_2_alleles, __pyx_k_must_set_at_least_2_alleles, sizeof(__pyx_k_must_set_at_least_2_alleles), 0, 1, 0, 0},
    {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
    {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
    {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
    {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
    {&__pyx_n_s_new_record, __pyx_k_new_record, sizeof(__pyx_k_new_record), 0, 0, 1, 1},
    {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
    {&__pyx_n_s_number, __pyx_k_number, sizeof(__pyx_k_number), 0, 0, 1, 1},
    {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
    {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
    {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
    {&__pyx_n_s_parse_region, __pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 0, 1, 1},
    {&__pyx_n_s_phased, __pyx_k_phased, sizeof(__pyx_k_phased), 0, 0, 1, 1},
    {&__pyx_n_u_phased, __pyx_k_phased, sizeof(__pyx_k_phased), 0, 1, 0, 1},
    {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
    {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
    {&__pyx_n_s_pysam_libcbcf, __pyx_k_pysam_libcbcf, sizeof(__pyx_k_pysam_libcbcf), 0, 0, 1, 1},
    {&__pyx_kp_s_pysam_libcbcf_pyx, __pyx_k_pysam_libcbcf_pyx, sizeof(__pyx_k_pysam_libcbcf_pyx), 0, 0, 1, 0},
    {&__pyx_n_s_pysam_utils, __pyx_k_pysam_utils, sizeof(__pyx_k_pysam_utils), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_BaseIndex, __pyx_k_pyx_unpickle_BaseIndex, sizeof(__pyx_k_pyx_unpickle_BaseIndex), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantContig, __pyx_k_pyx_unpickle_VariantContig, sizeof(__pyx_k_pyx_unpickle_VariantContig), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantHeaderCont, __pyx_k_pyx_unpickle_VariantHeaderCont, sizeof(__pyx_k_pyx_unpickle_VariantHeaderCont), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantHeaderMeta, __pyx_k_pyx_unpickle_VariantHeaderMeta, sizeof(__pyx_k_pyx_unpickle_VariantHeaderMeta), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantHeaderReco, __pyx_k_pyx_unpickle_VariantHeaderReco, sizeof(__pyx_k_pyx_unpickle_VariantHeaderReco), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantHeaderSamp, __pyx_k_pyx_unpickle_VariantHeaderSamp, sizeof(__pyx_k_pyx_unpickle_VariantHeaderSamp), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantMetadata, __pyx_k_pyx_unpickle_VariantMetadata, sizeof(__pyx_k_pyx_unpickle_VariantMetadata), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantRecordFilt, __pyx_k_pyx_unpickle_VariantRecordFilt, sizeof(__pyx_k_pyx_unpickle_VariantRecordFilt), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantRecordForm, __pyx_k_pyx_unpickle_VariantRecordForm, sizeof(__pyx_k_pyx_unpickle_VariantRecordForm), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantRecordInfo, __pyx_k_pyx_unpickle_VariantRecordInfo, sizeof(__pyx_k_pyx_unpickle_VariantRecordInfo), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantRecordSamp, __pyx_k_pyx_unpickle_VariantRecordSamp, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_unpickle_VariantRecordSamp_2, __pyx_k_pyx_unpickle_VariantRecordSamp_2, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp_2), 0, 0, 1, 1},
    {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
    {&__pyx_n_s_qual, __pyx_k_qual, sizeof(__pyx_k_qual), 0, 0, 1, 1},
    {&__pyx_n_s_quoted, __pyx_k_quoted, sizeof(__pyx_k_quoted), 0, 0, 1, 1},
    {&__pyx_n_b_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 0, 1},
    {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
    {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
    {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
    {&__pyx_n_s_rec, __pyx_k_rec, sizeof(__pyx_k_rec), 0, 0, 1, 1},
    {&__pyx_n_s_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 0, 1, 1},
    {&__pyx_kp_u_record_must_not_be_None, __pyx_k_record_must_not_be_None, sizeof(__pyx_k_record_must_not_be_None), 0, 1, 0, 0},
    {&__pyx_n_s_records, __pyx_k_records, sizeof(__pyx_k_records), 0, 0, 1, 1},
    {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
    {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
    {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
    {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
    {&__pyx_kp_u_ref_allele_must_not_be_null, __pyx_k_ref_allele_must_not_be_null, sizeof(__pyx_k_ref_allele_must_not_be_null), 0, 1, 0, 0},
    {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
    {&__pyx_n_s_region, __pyx_k_region, sizeof(__pyx_k_region), 0, 0, 1, 1},
    {&__pyx_n_s_remap, __pyx_k_remap, sizeof(__pyx_k_remap), 0, 0, 1, 1},
    {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
    {&__pyx_n_s_remove_header, __pyx_k_remove_header, sizeof(__pyx_k_remove_header), 0, 0, 1, 1},
    {&__pyx_n_s_reopen, __pyx_k_reopen, sizeof(__pyx_k_reopen), 0, 0, 1, 1},
    {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
    {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
    {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
    {&__pyx_n_s_rid, __pyx_k_rid, sizeof(__pyx_k_rid), 0, 0, 1, 1},
    {&__pyx_n_u_rwa, __pyx_k_rwa, sizeof(__pyx_k_rwa), 0, 1, 0, 1},
    {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1},
    {&__pyx_kp_u_sample_must_not_be_None, __pyx_k_sample_must_not_be_None, sizeof(__pyx_k_sample_must_not_be_None), 0, 1, 0, 0},
    {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1},
    {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
    {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
    {&__pyx_kp_s_self_iter_cannot_be_converted_to, __pyx_k_self_iter_cannot_be_converted_to, sizeof(__pyx_k_self_iter_cannot_be_converted_to), 0, 0, 1, 0},
    {&__pyx_kp_s_self_ptr_cannot_be_converted_to, __pyx_k_self_ptr_cannot_be_converted_to, sizeof(__pyx_k_self_ptr_cannot_be_converted_to), 0, 0, 1, 0},
    {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
    {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
    {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
    {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
    {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
    {&__pyx_n_s_src_hdr, __pyx_k_src_hdr, sizeof(__pyx_k_src_hdr), 0, 0, 1, 1},
    {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
    {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
    {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
    {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
    {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
    {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
    {&__pyx_n_s_subset_samples, __pyx_k_subset_samples, sizeof(__pyx_k_subset_samples), 0, 0, 1, 1},
    {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
    {&__pyx_kp_u_tabix_index_required, __pyx_k_tabix_index_required, sizeof(__pyx_k_tabix_index_required), 0, 1, 0, 0},
    {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
    {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
    {&__pyx_kp_u_this_class_cannot_be_instantiate, __pyx_k_this_class_cannot_be_instantiate, sizeof(__pyx_k_this_class_cannot_be_instantiate), 0, 1, 0, 0},
    {&__pyx_n_s_threads, __pyx_k_threads, sizeof(__pyx_k_threads), 0, 0, 1, 1},
    {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
    {&__pyx_n_s_tid, __pyx_k_tid, sizeof(__pyx_k_tid), 0, 0, 1, 1},
    {&__pyx_n_s_tidx, __pyx_k_tidx, sizeof(__pyx_k_tidx), 0, 0, 1, 1},
    {&__pyx_n_s_translate, __pyx_k_translate, sizeof(__pyx_k_translate), 0, 0, 1, 1},
    {&__pyx_kp_u_truncated_file, __pyx_k_truncated_file, sizeof(__pyx_k_truncated_file), 0, 1, 0, 0},
    {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
    {&__pyx_kp_u_unable_to_allocate_BCF_record, __pyx_k_unable_to_allocate_BCF_record, sizeof(__pyx_k_unable_to_allocate_BCF_record), 0, 1, 0, 0},
    {&__pyx_kp_u_unable_to_fetch, __pyx_k_unable_to_fetch, sizeof(__pyx_k_unable_to_fetch), 0, 1, 0, 0},
    {&__pyx_kp_u_unable_to_fetch_next_record, __pyx_k_unable_to_fetch_next_record, sizeof(__pyx_k_unable_to_fetch_next_record), 0, 1, 0, 0},
    {&__pyx_kp_u_unable_to_parse_next_record, __pyx_k_unable_to_parse_next_record, sizeof(__pyx_k_unable_to_parse_next_record), 0, 1, 0, 0},
    {&__pyx_kp_u_unable_to_reallocate_VariantHead, __pyx_k_unable_to_reallocate_VariantHead, sizeof(__pyx_k_unable_to_reallocate_VariantHead), 0, 1, 0, 0},
    {&__pyx_kp_u_unknown_INFO, __pyx_k_unknown_INFO, sizeof(__pyx_k_unknown_INFO), 0, 1, 0, 0},
    {&__pyx_kp_u_unknown_format, __pyx_k_unknown_format, sizeof(__pyx_k_unknown_format), 0, 1, 0, 0},
    {&__pyx_kp_u_unknown_mode, __pyx_k_unknown_mode, sizeof(__pyx_k_unknown_mode), 0, 1, 0, 0},
    {&__pyx_kp_u_unknown_type_specified, __pyx_k_unknown_type_specified, sizeof(__pyx_k_unknown_type_specified), 0, 1, 0, 0},
    {&__pyx_n_s_unquoted_str, __pyx_k_unquoted_str, sizeof(__pyx_k_unquoted_str), 0, 0, 1, 1},
    {&__pyx_kp_u_unsupported_header_type_code, __pyx_k_unsupported_header_type_code, sizeof(__pyx_k_unsupported_header_type_code), 0, 1, 0, 0},
    {&__pyx_kp_u_unsupported_info_type_code, __pyx_k_unsupported_info_type_code, sizeof(__pyx_k_unsupported_info_type_code), 0, 1, 0, 0},
    {&__pyx_kp_u_unsupported_type, __pyx_k_unsupported_type, sizeof(__pyx_k_unsupported_type), 0, 1, 0, 0},
    {&__pyx_kp_u_unsupported_types, __pyx_k_unsupported_types, sizeof(__pyx_k_unsupported_types), 0, 1, 0, 0},
    {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
    {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
    {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
    {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
    {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
    {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
    {&__pyx_kp_u_value_expected_to_be_scalar_give, __pyx_k_value_expected_to_be_scalar_give, sizeof(__pyx_k_value_expected_to_be_scalar_give), 0, 1, 0, 0},
    {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
    {&__pyx_kp_u_values_expected_to_be_tuple_give, __pyx_k_values_expected_to_be_tuple_give, sizeof(__pyx_k_values_expected_to_be_tuple_give), 0, 1, 0, 0},
    {&__pyx_n_s_vars, __pyx_k_vars, sizeof(__pyx_k_vars), 0, 0, 1, 1},
    {&__pyx_kp_u_vcf_format_failed, __pyx_k_vcf_format_failed, sizeof(__pyx_k_vcf_format_failed), 0, 1, 0, 0},
    {&__pyx_n_b_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 0, 1},
    {&__pyx_n_u_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 1, 0, 1},
    {&__pyx_n_u_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 0, 1},
    {&__pyx_n_u_wb0, __pyx_k_wb0, sizeof(__pyx_k_wb0), 0, 1, 0, 1},
    {&__pyx_n_u_wbu, __pyx_k_wbu, sizeof(__pyx_k_wbu), 0, 1, 0, 1},
    {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
    {&__pyx_n_u_wz, __pyx_k_wz, sizeof(__pyx_k_wz), 0, 1, 0, 1},
    {0, 0, 0, 0, 0, 0, 0}
  };
  return __Pyx_InitStrings(__pyx_string_tab);
}
/* #### Code section: cached_builtins ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 154, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 205, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 244, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 330, __pyx_L1_error)
  __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 563, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 698, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 1450, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 2088, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 2117, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 2370, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 2458, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 3881, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 3895, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pysam/libcbcf.pyx":244
 * 
 *     if sample < 0:
 *         raise ValueError('genotype is only valid as a format field')             # <<<<<<<<<<<<<<
 * 
 *     cdef int32_t *gt_arr = NULL
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_genotype_is_only_valid_as_a_form); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "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.
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_unsupported_info_type_code); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pysam/libcbcf.pyx":339
 *             value = ()
 *         else:
 *             value = (None,)*count             # <<<<<<<<<<<<<<
 *     elif scalar and len(value) == 1:
 *         value = value[0]
 */
  __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, Py_None)) __PYX_ERR(0, 339, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pysam/libcbcf.pyx":399
 *             bcf_float_set(dataf + i, bcf_float_vector_end)
 *     else:
 *         raise TypeError('unsupported type')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_unsupported_type); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pysam/libcbcf.pyx":409
 * 
 *     if n <= 0:
 *         raise ValueError('Cannot create empty array')             # <<<<<<<<<<<<<<
 * 
 *     if type == BCF_HT_STR:
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Cannot_create_empty_array); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "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
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_unsupported_header_type_code); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "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')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_unsupported_types); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "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_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_record_must_not_be_None); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "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_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Invalid_header); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "pysam/libcbcf.pyx":531
 *         count[0] = -1
 *     else:
 *         raise ValueError('Unknown format length')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Unknown_format_length); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "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_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_invalid_value_for_Float_format); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "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_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_invalid_value_for_Integer_format); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "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_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_Integer_value_too_small_large_to); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "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_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_Flag_values_must_be_True_False_N); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pysam/libcbcf.pyx":667
 *                     break
 *             else:
 *                 raise ValueError('Unknown allele')             # <<<<<<<<<<<<<<
 *         else:
 *             i = value
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_Unknown_allele); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "pysam/libcbcf.pyx":671
 *             i = value
 *             if not (0 <= i < nalleles):
 *                 raise ValueError('Invalid allele index')             # <<<<<<<<<<<<<<
 *             gt_values.append(bcf_gt_unphased(i))
 * 
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_Invalid_allele_index); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "pysam/libcbcf.pyx":687
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "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_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_update_INFO_values); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "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)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_Unsupported_INFO_type); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "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_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_sample_must_not_be_None); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "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_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_Flag_types_are_not_allowed_on_FO); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "pysam/libcbcf.pyx":908
 *         dst_size = sizeof(char) * alloc_len
 *     else:
 *         raise ValueError('Unsupported FORMAT type')             # <<<<<<<<<<<<<<
 * 
 *     if fmt and nsamples > 1:
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Unsupported_FORMAT_type); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "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_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_update_format_values); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "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_tuple__26 = PyTuple_Pack(1, __pyx_kp_u_Cannot_set_phased_before_genotyp); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "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_tuple__27 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_delete_END); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "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_tuple__28 = PyTuple_Pack(1, __pyx_n_u_END); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "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_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_header_must_not_be_None); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "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_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_Invalid_header_record_index); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "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_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_this_class_cannot_be_instantiate); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "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_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_cannot_find_metadata_key); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "pysam/libcbcf.pyx":1395
 * 
 *         if not r:
 *             raise ValueError('cannot convert deleted record to str')             # <<<<<<<<<<<<<<
 * 
 *         cdef kstring_t hrec_str
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_u_cannot_convert_deleted_record_to); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "pysam/libcbcf.pyx":1424
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not hdr:
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_u_invalid_VariantHeader); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "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_tuple__48 = PyTuple_Pack(1, __pyx_kp_u_invalid_header_record_index); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "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_tuple__51 = PyTuple_Pack(1, __pyx_kp_u_Invalid_header_id); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "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_tuple__57 = PyTuple_Pack(1, __pyx_kp_u_invalid_metadata_type); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "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_tuple__58 = PyTuple_Pack(1, __pyx_kp_u_invalid_metadata_id); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "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_tuple__60 = PyTuple_Pack(1, __pyx_kp_u_Number_must_be_None_when_adding); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "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_tuple__61 = PyTuple_Pack(1, __pyx_kp_u_Type_must_be_None_when_adding_a); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "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_tuple__76 = PyTuple_Pack(1, __pyx_kp_u_invalid_contig_id); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "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_tuple__77 = PyTuple_Pack(1, __pyx_kp_u_invalid_contig_index); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "pysam/libcbcf.pyx":1888
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()
 *         self.header.add_meta('contig', items=items)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_u_contig); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "pysam/libcbcf.pyx":1918
 * 
 *         if i < 0 or i >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return charptr_to_str(hdr.samples[i])
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_kp_u_invalid_sample_index); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "pysam/libcbcf.pyx":1971
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:
 *             raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_u_cannot_create_VariantHeader); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "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_tuple__98 = PyTuple_Pack(1, __pyx_kp_u_bcf_hdr_format_failed); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 2068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "pysam/libcbcf.pyx":2088
 * 
 *         if not rec:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         rec.ptr.n_sample = bcf_hdr_nsamples(self.ptr)
 */
  __pyx_tuple__100 = PyTuple_Pack(1, __pyx_kp_u_unable_to_allocate_BCF_record); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 2088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "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_tuple__103 = PyTuple_Pack(1, __pyx_kp_u_invalid_header_line); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "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_tuple__105 = PyTuple_Pack(1, __pyx_kp_u_either_value_or_items_must_be_sp); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 2145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "pysam/libcbcf.pyx":2182
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:
 *                 raise MemoryError('unable to reallocate VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def add_sample(self, name):
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_kp_u_unable_to_reallocate_VariantHead); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 2182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);

  /* "pysam/libcbcf.pyx":2258
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
 */
  __pyx_tuple__111 = PyTuple_Pack(1, __pyx_kp_u_invalid_filter_index); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 2258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);

  /* "pysam/libcbcf.pyx":2390
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)
 */
  __pyx_tuple__123 = PyTuple_Pack(1, __pyx_kp_u_invalid_VariantRecord); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "pysam/libcbcf.pyx":2447
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:
 *             raise ValueError('Unable to delete FORMAT')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_delete_FORMAT); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 2447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);

  /* "pysam/libcbcf.pyx":2586
 * 
 *         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_tuple__135 = PyTuple_Pack(1, __pyx_kp_u_END_is_a_reserved_attribute_acce); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "pysam/libcbcf.pyx":2649
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
 *             raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __pyx_tuple__136 = PyTuple_Pack(1, __pyx_kp_u_Unable_to_delete_INFO); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);

  /* "pysam/libcbcf.pyx":3033
 *     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_tuple__164 = PyTuple_Pack(1, __pyx_kp_u_dst_header_must_not_be_None); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 3033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);

  /* "pysam/libcbcf.pyx":3056
 *         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_tuple__165 = PyTuple_Pack(1, __pyx_kp_u_invalid_reference_id); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 3056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__165);
  __Pyx_GIVEREF(__pyx_tuple__165);

  /* "pysam/libcbcf.pyx":3074
 *         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_tuple__166 = PyTuple_Pack(1, __pyx_kp_u_Invalid_chromosome_contig); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 3074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);

  /* "pysam/libcbcf.pyx":3104
 *         cdef int p = value
 *         if p < 1:
 *             raise ValueError('Position must be positive')             # <<<<<<<<<<<<<<
 *         self.ptr.pos = p - 1
 *         bcf_sync_end(self)
 */
  __pyx_tuple__167 = PyTuple_Pack(1, __pyx_kp_u_Position_must_be_positive); if (unlikely(!__pyx_tuple__167)) __PYX_ERR(0, 3104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__167);
  __Pyx_GIVEREF(__pyx_tuple__167);

  /* "pysam/libcbcf.pyx":3117
 *         cdef int s = value
 *         if s < 0:
 *             raise ValueError('Start coordinate must be non-negative')             # <<<<<<<<<<<<<<
 *         self.ptr.pos = s
 *         bcf_sync_end(self)
 */
  __pyx_tuple__168 = PyTuple_Pack(1, __pyx_kp_u_Start_coordinate_must_be_non_neg); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 3117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);

  /* "pysam/libcbcf.pyx":3130
 *         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_tuple__169 = PyTuple_Pack(1, __pyx_kp_u_Stop_coordinate_must_be_non_nega); if (unlikely(!__pyx_tuple__169)) __PYX_ERR(0, 3130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__169);
  __Pyx_GIVEREF(__pyx_tuple__169);

  /* "pysam/libcbcf.pyx":3175
 *         # 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_tuple__170 = PyTuple_Pack(1, __pyx_kp_u_Error_extracting_ID); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 3175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);

  /* "pysam/libcbcf.pyx":3188
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:
 *             raise ValueError('Error updating id')             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_tuple__171 = PyTuple_Pack(1, __pyx_kp_u_Error_updating_id); if (unlikely(!__pyx_tuple__171)) __PYX_ERR(0, 3188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__171);
  __Pyx_GIVEREF(__pyx_tuple__171);

  /* "pysam/libcbcf.pyx":3205
 *         #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_tuple__172 = PyTuple_Pack(1, __pyx_kp_u_ref_allele_must_not_be_null); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);

  /* "pysam/libcbcf.pyx":3243
 * 
 *         if len(values) < 2:
 *             raise ValueError('must set at least 2 alleles')             # <<<<<<<<<<<<<<
 * 
 *         if b'' in values:
 */
  __pyx_tuple__173 = PyTuple_Pack(1, __pyx_kp_u_must_set_at_least_2_alleles); if (unlikely(!__pyx_tuple__173)) __PYX_ERR(0, 3243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__173);
  __Pyx_GIVEREF(__pyx_tuple__173);

  /* "pysam/libcbcf.pyx":3246
 * 
 *         if b'' in values:
 *             raise ValueError('cannot set null allele')             # <<<<<<<<<<<<<<
 * 
 *         value = b','.join(values)
 */
  __pyx_tuple__174 = PyTuple_Pack(1, __pyx_kp_u_cannot_set_null_allele); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 3246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);

  /* "pysam/libcbcf.pyx":3251
 * 
 *         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_tuple__175 = PyTuple_Pack(1, __pyx_kp_u_Error_updating_alleles); if (unlikely(!__pyx_tuple__175)) __PYX_ERR(0, 3251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__175);
  __Pyx_GIVEREF(__pyx_tuple__175);

  /* "pysam/libcbcf.pyx":3284
 *         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_tuple__176 = PyTuple_Pack(1, __pyx_kp_u_cannot_set_null_alt_allele); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);

  /* "pysam/libcbcf.pyx":3381
 *             if line.m:
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')             # <<<<<<<<<<<<<<
 * 
 *         # Strip CR/LF?
 */
  __pyx_tuple__177 = PyTuple_Pack(1, __pyx_kp_u_vcf_format_failed); if (unlikely(!__pyx_tuple__177)) __PYX_ERR(0, 3381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__177);
  __Pyx_GIVEREF(__pyx_tuple__177);

  /* "pysam/libcbcf.pyx":3403
 * 
 *     if not r:
 *         raise ValueError('cannot create VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if r.errcode:
 */
  __pyx_tuple__180 = PyTuple_Pack(1, __pyx_kp_u_cannot_create_VariantRecord); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 3403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);

  /* "pysam/libcbcf.pyx":3488
 * 
 *         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_tuple__182 = PyTuple_Pack(1, __pyx_kp_u_Use_allele_indices_to_set_intege); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(0, 3488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);

  /* "pysam/libcbcf.pyx":3494
 *             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_tuple__183 = PyTuple_Pack(1, __pyx_kp_u_One_or_more_of_the_supplied_samp); if (unlikely(!__pyx_tuple__183)) __PYX_ERR(0, 3494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__183);
  __Pyx_GIVEREF(__pyx_tuple__183);

  /* "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')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)
 */
  __pyx_tuple__197 = PyTuple_Pack(1, __pyx_kp_u_cannot_create_VariantRecordSampl); if (unlikely(!__pyx_tuple__197)) __PYX_ERR(0, 3647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__197);
  __Pyx_GIVEREF(__pyx_tuple__197);

  /* "pysam/libcbcf.pyx":3758
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
  __pyx_tuple__210 = PyTuple_Pack(1, __pyx_kp_u_Invalid_index_object); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 3758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);

  /* "pysam/libcbcf.pyx":3848
 *     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_tuple__219 = PyTuple_Pack(1, __pyx_kp_u_bcf_must_not_be_None); if (unlikely(!__pyx_tuple__219)) __PYX_ERR(0, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__219);
  __Pyx_GIVEREF(__pyx_tuple__219);

  /* "pysam/libcbcf.pyx":3851
 * 
 *         if contig is None:
 *             raise ValueError('contig must be specified')             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 */
  __pyx_tuple__220 = PyTuple_Pack(1, __pyx_kp_u_contig_must_be_specified); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 3851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);

  /* "pysam/libcbcf.pyx":3854
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef BCFIndex index = bcf.index
 */
  __pyx_tuple__221 = PyTuple_Pack(1, __pyx_kp_u_bcf_index_required); if (unlikely(!__pyx_tuple__221)) __PYX_ERR(0, 3854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__221);
  __Pyx_GIVEREF(__pyx_tuple__221);

  /* "pysam/libcbcf.pyx":3916
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
 */
  __pyx_tuple__222 = PyTuple_Pack(1, __pyx_kp_u_truncated_file); if (unlikely(!__pyx_tuple__222)) __PYX_ERR(0, 3916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__222);
  __Pyx_GIVEREF(__pyx_tuple__222);

  /* "pysam/libcbcf.pyx":3920
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
 */
  __pyx_tuple__223 = PyTuple_Pack(1, __pyx_kp_u_unable_to_fetch_next_record); if (unlikely(!__pyx_tuple__223)) __PYX_ERR(0, 3920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__223);
  __Pyx_GIVEREF(__pyx_tuple__223);

  /* "pysam/libcbcf.pyx":3926
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
  __pyx_tuple__224 = PyTuple_Pack(1, __pyx_kp_u_error_in_bcf_subset_format); if (unlikely(!__pyx_tuple__224)) __PYX_ERR(0, 3926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__224);
  __Pyx_GIVEREF(__pyx_tuple__224);

  /* "pysam/libcbcf.pyx":3942
 * 
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef TabixIndex index = bcf.index
 */
  __pyx_tuple__227 = PyTuple_Pack(1, __pyx_kp_u_tabix_index_required); if (unlikely(!__pyx_tuple__227)) __PYX_ERR(0, 3942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__227);
  __Pyx_GIVEREF(__pyx_tuple__227);

  /* "pysam/libcbcf.pyx":4022
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
  __pyx_tuple__228 = PyTuple_Pack(1, __pyx_kp_u_error_in_vcf_parse); if (unlikely(!__pyx_tuple__228)) __PYX_ERR(0, 4022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__228);
  __Pyx_GIVEREF(__pyx_tuple__228);

  /* "pysam/libcbcf.pyx":4158
 *     def __iter__(self):
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
 */
  __pyx_tuple__232 = PyTuple_Pack(1, __pyx_kp_u_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__232)) __PYX_ERR(0, 4158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__232);
  __Pyx_GIVEREF(__pyx_tuple__232);

  /* "pysam/libcbcf.pyx":4161
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot iterate over Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
  __pyx_tuple__233 = PyTuple_Pack(1, __pyx_kp_u_cannot_iterate_over_Variantfile); if (unlikely(!__pyx_tuple__233)) __PYX_ERR(0, 4161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__233);
  __Pyx_GIVEREF(__pyx_tuple__233);

  /* "pysam/libcbcf.pyx":4185
 *             bcf_destroy1(record)
 *             if errcode:
 *                 raise IOError('unable to parse next record')             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
 */
  __pyx_tuple__234 = PyTuple_Pack(1, __pyx_kp_u_unable_to_parse_next_record); if (unlikely(!__pyx_tuple__234)) __PYX_ERR(0, 4185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);

  /* "pysam/libcbcf.pyx":4208
 * 
 *         if not vars.htsfile:
 *             raise ValueError('Cannot re-open htsfile')             # <<<<<<<<<<<<<<
 * 
 *         # minimize overhead by re-using header and index.  This approach is
 */
  __pyx_tuple__236 = PyTuple_Pack(1, __pyx_kp_u_Cannot_re_open_htsfile); if (unlikely(!__pyx_tuple__236)) __PYX_ERR(0, 4208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__236);
  __Pyx_GIVEREF(__pyx_tuple__236);

  /* "pysam/libcbcf.pyx":4261
 *             # 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_tuple__238 = PyTuple_Pack(1, __pyx_kp_u_Cannot_add_extra_threads_when_ig); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(0, 4261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);

  /* "pysam/libcbcf.pyx":4269
 * 
 *         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_tuple__239 = PyTuple_Pack(1, __pyx_kp_u_mode_must_begin_with_r_w_or_a); if (unlikely(!__pyx_tuple__239)) __PYX_ERR(0, 4269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__239);
  __Pyx_GIVEREF(__pyx_tuple__239);

  /* "pysam/libcbcf.pyx":4273
 *         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_slice__240 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__240)) __PYX_ERR(0, 4273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__240);
  __Pyx_GIVEREF(__pyx_slice__240);

  /* "pysam/libcbcf.pyx":4317
 *             # 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_tuple__242 = PyTuple_Pack(1, __pyx_kp_u_Cannot_specify_an_index_filename); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(0, 4317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);

  /* "pysam/libcbcf.pyx":4422
 *         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_tuple__247 = PyTuple_Pack(1, __pyx_kp_u_Invalid_tid); if (unlikely(!__pyx_tuple__247)) __PYX_ERR(0, 4422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__247);
  __Pyx_GIVEREF(__pyx_tuple__247);

  /* "pysam/libcbcf.pyx":4451
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot fetch from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if contig is None and region is None:
 */
  __pyx_tuple__249 = PyTuple_Pack(1, __pyx_kp_u_cannot_fetch_from_Variantfile_op); if (unlikely(!__pyx_tuple__249)) __PYX_ERR(0, 4451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__249);
  __Pyx_GIVEREF(__pyx_tuple__249);

  /* "pysam/libcbcf.pyx":4460
 * 
 *         if self.index is None:
 *             raise ValueError('fetch requires an index')             # <<<<<<<<<<<<<<
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,
 */
  __pyx_tuple__250 = PyTuple_Pack(1, __pyx_kp_u_fetch_requires_an_index); if (unlikely(!__pyx_tuple__250)) __PYX_ERR(0, 4460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__250);
  __Pyx_GIVEREF(__pyx_tuple__250);

  /* "pysam/libcbcf.pyx":4491
 * 
 *         if not self.htsfile.is_write:
 *             raise ValueError('cannot write to a Variantfile opened for reading')             # <<<<<<<<<<<<<<
 * 
 *         if not self.header_written:
 */
  __pyx_tuple__253 = PyTuple_Pack(1, __pyx_kp_u_cannot_write_to_a_Variantfile_op); if (unlikely(!__pyx_tuple__253)) __PYX_ERR(0, 4491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__253);
  __Pyx_GIVEREF(__pyx_tuple__253);

  /* "pysam/libcbcf.pyx":4528
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if self.is_reading:
 */
  __pyx_tuple__255 = PyTuple_Pack(1, __pyx_kp_u_cannot_subset_samples_from_Varia); if (unlikely(!__pyx_tuple__255)) __PYX_ERR(0, 4528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__255);
  __Pyx_GIVEREF(__pyx_tuple__255);

  /* "pysam/libcbcf.pyx":4531
 * 
 *         if self.is_reading:
 *             raise ValueError('cannot subset samples after fetching records')             # <<<<<<<<<<<<<<
 * 
 *         self.header._subset_samples(include_samples)
 */
  __pyx_tuple__256 = PyTuple_Pack(1, __pyx_kp_u_cannot_subset_samples_after_fetc); if (unlikely(!__pyx_tuple__256)) __PYX_ERR(0, 4531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__256);
  __Pyx_GIVEREF(__pyx_tuple__256);

  /* "(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_tuple__260 = PyTuple_Pack(3, __pyx_int_31479882, __pyx_int_93650198, __pyx_int_10091417); if (unlikely(!__pyx_tuple__260)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__260);
  __Pyx_GIVEREF(__pyx_tuple__260);
  __pyx_tuple__262 = PyTuple_Pack(3, __pyx_int_215036767, __pyx_int_168021462, __pyx_int_164668780); if (unlikely(!__pyx_tuple__262)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__262);
  __Pyx_GIVEREF(__pyx_tuple__262);
  __pyx_tuple__264 = PyTuple_Pack(3, __pyx_int_135711299, __pyx_int_10698032, __pyx_int_248899179); if (unlikely(!__pyx_tuple__264)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__264);
  __Pyx_GIVEREF(__pyx_tuple__264);
  __pyx_tuple__266 = PyTuple_Pack(3, __pyx_int_39264352, __pyx_int_145625440, __pyx_int_199651019); if (unlikely(!__pyx_tuple__266)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__266);
  __Pyx_GIVEREF(__pyx_tuple__266);
  __pyx_tuple__270 = PyTuple_Pack(3, __pyx_int_118286449, __pyx_int_41264896, __pyx_int_232881935); if (unlikely(!__pyx_tuple__270)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__270);
  __Pyx_GIVEREF(__pyx_tuple__270);
  __pyx_tuple__275 = PyTuple_Pack(3, __pyx_int_250317299, __pyx_int_94171383, __pyx_int_97976187); if (unlikely(!__pyx_tuple__275)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__275);
  __Pyx_GIVEREF(__pyx_tuple__275);
  __pyx_tuple__277 = PyTuple_Pack(3, __pyx_int_126454353, __pyx_int_33440904, __pyx_int_227765731); if (unlikely(!__pyx_tuple__277)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__277);
  __Pyx_GIVEREF(__pyx_tuple__277);

  /* "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_tuple__279 = PyTuple_Pack(4, __pyx_n_u_Flag, __pyx_n_u_Integer, __pyx_n_u_Float, __pyx_n_u_String); if (unlikely(!__pyx_tuple__279)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);

  /* "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_tuple__280 = PyTuple_Pack(6, __pyx_n_u_FILTER, __pyx_n_u_INFO, __pyx_n_u_FORMAT, __pyx_n_u_CONTIG, __pyx_n_u_STRUCTURED, __pyx_n_u_GENERIC); if (unlikely(!__pyx_tuple__280)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__280);
  __Pyx_GIVEREF(__pyx_tuple__280);

  /* "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_tuple__281 = PyTuple_Pack(5, __pyx_n_u_FIXED, __pyx_n_u_VARIABLE, __pyx_n_u_A, __pyx_n_u_G, __pyx_n_u_R); if (unlikely(!__pyx_tuple__281)) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);

  /* "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_tuple__282 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default); if (unlikely(!__pyx_tuple__282)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__282);
  __Pyx_GIVEREF(__pyx_tuple__282);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 1313, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 1313, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1328
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_tuple__283 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__283)) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__283);
  __Pyx_GIVEREF(__pyx_tuple__283);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 1328, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 1328, __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
 */
  __pyx_tuple__284 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_r, __pyx_n_s_i); if (unlikely(!__pyx_tuple__284)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__284);
  __Pyx_GIVEREF(__pyx_tuple__284);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 1332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 1332, __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
 */
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 1342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 1342, __pyx_L1_error)

  /* "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_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 1352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 1352, __pyx_L1_error)

  /* "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_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 1356, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 1356, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1360
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 1360, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 1360, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1364
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_tuple__285 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_items, __pyx_n_s_kwargs, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__285)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__285);
  __Pyx_GIVEREF(__pyx_tuple__285);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_update, 1364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 1364, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1376
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __pyx_tuple__286 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default, __pyx_n_s_value); if (unlikely(!__pyx_tuple__286)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__286);
  __Pyx_GIVEREF(__pyx_tuple__286);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_pop, 1376, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 1376, __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_tuple__287 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_key); if (unlikely(!__pyx_tuple__287)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__287);
  __Pyx_GIVEREF(__pyx_tuple__287);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__287, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_remove, 1411, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1411, __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):
 */
  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(4, 1, __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"
 */
  __pyx_tuple__288 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__288)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__288);
  __Pyx_GIVEREF(__pyx_tuple__288);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_tuple__289 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__289)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__289);
  __Pyx_GIVEREF(__pyx_tuple__289);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "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_tuple__290 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_key); if (unlikely(!__pyx_tuple__290)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__290);
  __Pyx_GIVEREF(__pyx_tuple__290);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__290, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_remove_header, 1536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 1536, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "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_tuple__291 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_id, __pyx_n_s_number, __pyx_n_s_type, __pyx_n_s_description, __pyx_n_s_kwargs, __pyx_n_s_items); if (unlikely(!__pyx_tuple__291)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__291);
  __Pyx_GIVEREF(__pyx_tuple__291);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add, 1565, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 1565, __pyx_L1_error)

  /* "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_tuple__292 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_hdr, __pyx_n_s_d, __pyx_n_s_bkey, __pyx_n_s_k); if (unlikely(!__pyx_tuple__292)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__292);
  __Pyx_GIVEREF(__pyx_tuple__292);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__292, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_remove_header, 1625, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 1625, __pyx_L1_error)

  /* "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_tuple__293 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_hdr); if (unlikely(!__pyx_tuple__293)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__293);
  __Pyx_GIVEREF(__pyx_tuple__293);
  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear_header, 1638, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 1638, __pyx_L1_error)

  /* "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_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 1653, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 1653, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1668
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 1668, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 1668, __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:
 */
  __pyx_tuple__294 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_key); if (unlikely(!__pyx_tuple__294)) __PYX_ERR(0, 1672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__294);
  __Pyx_GIVEREF(__pyx_tuple__294);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 1672, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 1672, __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:
 */
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 1677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 1677, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1682
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 1682, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 1682, __pyx_L1_error)

  /* "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_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 1686, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 1686, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1690
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 1690, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 1690, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "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_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__290, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_remove_header, 1741, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1741, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__75 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "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_tuple__295 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_hdr, __pyx_n_s_index, __pyx_n_s_ckey, __pyx_n_s_d, __pyx_n_s_k); if (unlikely(!__pyx_tuple__295)) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__295);
  __Pyx_GIVEREF(__pyx_tuple__295);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__295, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_remove_header, 1797, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1797, __pyx_L1_error)

  /* "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_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear_header, 1818, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 1818, __pyx_L1_error)

  /* "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_codeobj__80 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 1833, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1833, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1848
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 1848, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 1848, __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:
 */
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 1852, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 1852, __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:
 */
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 1857, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 1857, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1862
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 1862, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1862, __pyx_L1_error)

  /* "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_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 1866, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 1866, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1870
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 1870, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1870, __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_tuple__296 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_id, __pyx_n_s_length, __pyx_n_s_kwargs, __pyx_n_s_items); if (unlikely(!__pyx_tuple__296)) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__296);
  __Pyx_GIVEREF(__pyx_tuple__296);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__296, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add, 1879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 1879, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__90 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1942
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample"""
 *         self.header.add_sample(name)
 */
  __pyx_tuple__297 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_name); if (unlikely(!__pyx_tuple__297)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__297);
  __Pyx_GIVEREF(__pyx_tuple__297);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__297, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add, 1942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1942, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__94 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1981
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 */
  __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_copy, 1981, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1981, __pyx_L1_error)

  /* "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_tuple__298 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_header); if (unlikely(!__pyx_tuple__298)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__298);
  __Pyx_GIVEREF(__pyx_tuple__298);
  __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__298, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_merge, 1984, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 1984, __pyx_L1_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):
 */
  __pyx_tuple__299 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_contig, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_alleles, __pyx_n_s_id, __pyx_n_s_qual, __pyx_n_s_filter, __pyx_n_s_info, __pyx_n_s_samples, __pyx_n_s_kwargs, __pyx_n_s_rec, __pyx_n_s_f, __pyx_n_s_i, __pyx_n_s_sample); if (unlikely(!__pyx_tuple__299)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__299);
  __Pyx_GIVEREF(__pyx_tuple__299);
  __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__299, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_new_record, 2076, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __pyx_tuple__300 = PyTuple_Pack(9, Py_None, __pyx_int_0, __pyx_int_0, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__300)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__300);
  __Pyx_GIVEREF(__pyx_tuple__300);

  /* "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_tuple__301 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_record, __pyx_n_s_hrec); if (unlikely(!__pyx_tuple__301)) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__301);
  __Pyx_GIVEREF(__pyx_tuple__301);
  __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__301, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add_record, 2122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(0, 2122, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2133
 *         self._hdr_sync()
 * 
 *     def add_line(self, line):             # <<<<<<<<<<<<<<
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
 */
  __pyx_tuple__302 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_line, __pyx_n_s_bline); if (unlikely(!__pyx_tuple__302)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__302);
  __Pyx_GIVEREF(__pyx_tuple__302);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add_line, 2133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 2133, __pyx_L1_error)

  /* "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_tuple__303 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_value, __pyx_n_s_items, __pyx_n_s_hrec, __pyx_n_s_quoted); if (unlikely(!__pyx_tuple__303)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__303);
  __Pyx_GIVEREF(__pyx_tuple__303);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__303, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add_meta, 2142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __pyx_tuple__304 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__304)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);

  /* "pysam/libcbcf.pyx":2184
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
 *     def add_sample(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
 */
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__297, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add_sample, 2184, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 2184, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2189
 *         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_tuple__305 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_arg, __pyx_n_s_name); if (unlikely(!__pyx_tuple__305)) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__305);
  __Pyx_GIVEREF(__pyx_tuple__305);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__305, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add_samples, 2189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 2189, __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):
 */
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(4, 1, __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__"
 */
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2273
 *         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_tuple__306 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_id, __pyx_n_s_bkey); if (unlikely(!__pyx_tuple__306)) __PYX_ERR(0, 2273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_add, 2273, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(0, 2273, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2315
 *         bcf_remove_filter(hdr, r, id, 0)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
 */
  __pyx_tuple__307 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_r); if (unlikely(!__pyx_tuple__307)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__307);
  __Pyx_GIVEREF(__pyx_tuple__307);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__307, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear, 2315, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 2315, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2329
 *             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_codeobj__114 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 2329, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 2329, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2342
 *         return bcf_has_filter(hdr, r, bkey) == 1
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 2342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 2342, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2346
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 2346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 2346, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2351
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 2351, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 2351, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2356
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 2356, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(0, 2356, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2360
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 2360, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 2360, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2364
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 2364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(0, 2364, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__122 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2449
 *             raise ValueError('Unable to delete FORMAT')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
 */
  __pyx_tuple__308 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_fmt, __pyx_n_s_key, __pyx_n_s_i); if (unlikely(!__pyx_tuple__308)) __PYX_ERR(0, 2449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear, 2449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 2449, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2476
 *                 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_codeobj__126 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 2476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(0, 2476, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2490
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 2490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 2490, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2494
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 2494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 2494, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2499
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 2499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 2499, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2504
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 2504, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 2504, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2508
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 2508, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 2508, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2512
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 2512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 2512, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__134 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2651
 *             raise ValueError('Unable to delete INFO')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 */
  __pyx_tuple__309 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_info, __pyx_n_s_key, __pyx_n_s_i); if (unlikely(!__pyx_tuple__309)) __PYX_ERR(0, 2651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__309);
  __Pyx_GIVEREF(__pyx_tuple__309);
  __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__309, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear, 2651, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 2651, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2688
 *                     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_tuple__310 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_bkey, __pyx_n_s_info, __pyx_n_s_info_id); if (unlikely(!__pyx_tuple__310)) __PYX_ERR(0, 2688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 2688, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(0, 2688, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2734
 *         return info != NULL and info.vptr != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 2734, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 2734, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2738
 *         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_codeobj__140 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__309, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 2738, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(0, 2738, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2756
 *                     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_tuple__311 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_info, __pyx_n_s_key, __pyx_n_s_i, __pyx_n_s_value); if (unlikely(!__pyx_tuple__311)) __PYX_ERR(0, 2756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__311);
  __Pyx_GIVEREF(__pyx_tuple__311);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__311, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 2756, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 2756, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2775
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 2775, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(0, 2775, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2779
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 2779, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 2779, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2783
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 2783, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(0, 2783, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2787
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_update, 2787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 2787, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2801
 *                 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_tuple__312 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_default, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_bkey, __pyx_n_s_info, __pyx_n_s_info_id, __pyx_n_s_value); if (unlikely(!__pyx_tuple__312)) __PYX_ERR(0, 2801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_pop, 2801, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 2801, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__149 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2907
 *             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_codeobj__150 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 2907, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 2907, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2932
 *         return 0 <= sample_index < n
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 2932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) __PYX_ERR(0, 2932, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2936
 *         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_tuple__313 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_i, __pyx_n_s_n); if (unlikely(!__pyx_tuple__313)) __PYX_ERR(0, 2936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__313);
  __Pyx_GIVEREF(__pyx_tuple__313);
  __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__313, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 2936, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 2936, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2945
 *             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_codeobj__153 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__313, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 2945, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) __PYX_ERR(0, 2945, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2954
 *             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_codeobj__154 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 2954, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 2954, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2958
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 2958, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) __PYX_ERR(0, 2958, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2962
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 2962, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 2962, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2966
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_update, 2966, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(0, 2966, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2978
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_pop, 2978, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 2978, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__161 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3027
 *             self.ptr = NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
 */
  __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_copy, 3027, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 3027, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3031
 *         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_tuple__314 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_dst_header, __pyx_n_s_src_hdr, __pyx_n_s_dst_hdr, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);
  __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__314, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_translate, 3031, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 3031, __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):
 */
  __pyx_codeobj__178 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__178)) __PYX_ERR(4, 1, __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"
 */
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3545
 *         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_tuple__315 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_hdr, __pyx_n_s_r, __pyx_n_s_fmt, __pyx_n_s_i); if (unlikely(!__pyx_tuple__315)) __PYX_ERR(0, 3545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__315);
  __Pyx_GIVEREF(__pyx_tuple__315);
  __pyx_codeobj__184 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__315, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_clear, 3545, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__184)) __PYX_ERR(0, 3545, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3568
 *                 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_codeobj__185 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 3568, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 3568, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3582
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__186 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 3582, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__186)) __PYX_ERR(0, 3582, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3586
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 3586, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 3586, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3591
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_codeobj__188 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 3591, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__188)) __PYX_ERR(0, 3591, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3596
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 3596, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(0, 3596, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3600
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__190 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 3600, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__190)) __PYX_ERR(0, 3600, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3604
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 3604, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 3604, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3608
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_codeobj__192 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_update, 3608, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__192)) __PYX_ERR(0, 3608, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3620
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __pyx_codeobj__194 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_pop, 3620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__194)) __PYX_ERR(0, 3620, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__196 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3682
 *         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_codeobj__198 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get, 3682, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__198)) __PYX_ERR(0, 3682, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3697
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iterkeys, 3697, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(0, 3697, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3701
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_codeobj__200 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_itervalues, 3701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__200)) __PYX_ERR(0, 3701, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3706
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_iteritems, 3706, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(0, 3706, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3711
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_codeobj__202 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_keys, 3711, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__202)) __PYX_ERR(0, 3711, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3715
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_items, 3715, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) __PYX_ERR(0, 3715, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3719
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_codeobj__204 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_values, 3719, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__204)) __PYX_ERR(0, 3719, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3723
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_update, 3723, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(0, 3723, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3735
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __pyx_codeobj__207 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_pop, 3735, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__207)) __PYX_ERR(0, 3735, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) __PYX_ERR(4, 1, __pyx_L1_error)

  /* "(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_codeobj__209 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3771
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, reopen)
 * 
 */
  __pyx_tuple__316 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_bcf, __pyx_n_s_contig, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_reopen); if (unlikely(!__pyx_tuple__316)) __PYX_ERR(0, 3771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__316);
  __Pyx_GIVEREF(__pyx_tuple__316);
  __pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__316, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_fetch, 3771, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(0, 3771, __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):
 */
  __pyx_codeobj__212 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__212)) __PYX_ERR(4, 1, __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"
 */
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3810
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, reopen)
 * 
 */
  __pyx_codeobj__214 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__316, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_fetch, 3810, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__214)) __PYX_ERR(0, 3810, __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):
 */
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(4, 1, __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"
 */
  __pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) __PYX_ERR(4, 3, __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):
 */
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(4, 1, __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"
 */
  __pyx_codeobj__218 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__218)) __PYX_ERR(4, 3, __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):
 */
  __pyx_codeobj__225 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__225)) __PYX_ERR(4, 1, __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"
 */
  __pyx_codeobj__226 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__226)) __PYX_ERR(4, 3, __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):
 */
  __pyx_codeobj__229 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__229)) __PYX_ERR(4, 1, __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__"
 */
  __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4135
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
 */
  __pyx_tuple__317 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__317)) __PYX_ERR(0, 4135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__317);
  __Pyx_GIVEREF(__pyx_tuple__317);
  __pyx_codeobj__231 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__317, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_close, 4135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__231)) __PYX_ERR(0, 4135, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4197
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
 */
  __pyx_tuple__318 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_vars, __pyx_n_s_hdr); if (unlikely(!__pyx_tuple__318)) __PYX_ERR(0, 4197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__318);
  __Pyx_GIVEREF(__pyx_tuple__318);
  __pyx_codeobj__235 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__318, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_copy, 4197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__235)) __PYX_ERR(0, 4197, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4235
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
 */
  __pyx_tuple__319 = PyTuple_Pack(20, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_mode, __pyx_n_s_index_filename, __pyx_n_s_header, __pyx_n_s_drop_samples, __pyx_n_s_duplicate_filehandle, __pyx_n_s_ignore_truncation, __pyx_n_s_threads, __pyx_n_s_hdr, __pyx_n_s_bgzfp, __pyx_n_s_idx, __pyx_n_s_tidx, __pyx_n_s_cfilename, __pyx_n_s_cindex_filename, __pyx_n_s_cmode, __pyx_n_s_format_modes, __pyx_n_s_invalid_modes, __pyx_n_s_m, __pyx_n_s_m); if (unlikely(!__pyx_tuple__319)) __PYX_ERR(0, 4235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__319);
  __Pyx_GIVEREF(__pyx_tuple__319);
  __pyx_codeobj__237 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_open, 4235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__237)) __PYX_ERR(0, 4235, __pyx_L1_error)
  __pyx_tuple__320 = PyTuple_Pack(7, __pyx_n_u_r, Py_None, Py_None, Py_False, Py_True, Py_False, __pyx_int_1); if (unlikely(!__pyx_tuple__320)) __PYX_ERR(0, 4235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__320);
  __Pyx_GIVEREF(__pyx_tuple__320);

  /* "pysam/libcbcf.pyx":4380
 *             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_codeobj__243 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_reset, 4380, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__243)) __PYX_ERR(0, 4380, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4384
 *         return self.seek(self.start_offset)
 * 
 *     def is_valid_tid(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return True if the numerical :term:`tid` is valid; False otherwise.
 */
  __pyx_tuple__321 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_tid, __pyx_n_s_hdr, __pyx_n_s_rid); if (unlikely(!__pyx_tuple__321)) __PYX_ERR(0, 4384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__321);
  __Pyx_GIVEREF(__pyx_tuple__321);
  __pyx_codeobj__244 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__321, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_is_valid_tid, 4384, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__244)) __PYX_ERR(0, 4384, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4397
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 *     def get_tid(self, reference):             # <<<<<<<<<<<<<<
 *         """
 *         return the numerical :term:`tid` corresponding to
 */
  __pyx_tuple__322 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_reference, __pyx_n_s_d, __pyx_n_s_k); if (unlikely(!__pyx_tuple__322)) __PYX_ERR(0, 4397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__322);
  __Pyx_GIVEREF(__pyx_tuple__322);
  __pyx_codeobj__245 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__322, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get_tid, 4397, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__245)) __PYX_ERR(0, 4397, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4412
 *         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_codeobj__246 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__321, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_get_reference_name, 4412, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__246)) __PYX_ERR(0, 4412, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4425
 *         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_tuple__324 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_contig, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_region, __pyx_n_s_reopen, __pyx_n_s_end, __pyx_n_s_reference, __pyx_n_s_bcf, __pyx_n_s__323, __pyx_n_s_tid); if (unlikely(!__pyx_tuple__324)) __PYX_ERR(0, 4425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__324);
  __Pyx_GIVEREF(__pyx_tuple__324);
  __pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__324, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_fetch, 4425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) __PYX_ERR(0, 4425, __pyx_L1_error)
  __pyx_tuple__325 = PyTuple_Pack(7, Py_None, Py_None, Py_None, Py_None, Py_False, Py_None, Py_None); if (unlikely(!__pyx_tuple__325)) __PYX_ERR(0, 4425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__325);
  __Pyx_GIVEREF(__pyx_tuple__325);

  /* "pysam/libcbcf.pyx":4471
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
 *     def new_record(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Create a new empty :class:`VariantRecord`.
 * 
 */
  __pyx_tuple__326 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__326)) __PYX_ERR(0, 4471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__326);
  __Pyx_GIVEREF(__pyx_tuple__326);
  __pyx_codeobj__251 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__326, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_new_record, 4471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__251)) __PYX_ERR(0, 4471, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4478
 *         return self.header.new_record(*args, **kwargs)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
 */
  __pyx_tuple__327 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_record); if (unlikely(!__pyx_tuple__327)) __PYX_ERR(0, 4478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__327);
  __Pyx_GIVEREF(__pyx_tuple__327);
  __pyx_codeobj__252 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__327, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_write, 4478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__252)) __PYX_ERR(0, 4478, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":4519
 *         return ret
 * 
 *     def subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         """
 *         Read only a subset of samples to reduce processing time and memory.
 */
  __pyx_tuple__328 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_include_samples); if (unlikely(!__pyx_tuple__328)) __PYX_ERR(0, 4519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__328);
  __Pyx_GIVEREF(__pyx_tuple__328);
  __pyx_codeobj__254 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__328, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcf_pyx, __pyx_n_s_subset_samples, 4519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__254)) __PYX_ERR(0, 4519, __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):
 */
  __pyx_codeobj__257 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__257)) __PYX_ERR(4, 1, __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__"
 */
  __pyx_codeobj__258 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__258)) __PYX_ERR(4, 3, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderRecords(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__329 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__329)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__329);
  __Pyx_GIVEREF(__pyx_tuple__329);
  __pyx_codeobj__259 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantHeaderReco, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__259)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__261 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantMetadata, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__261)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__263 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantHeaderMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__263)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__265 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantContig, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__265)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__267 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantHeaderCont, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__267)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__268 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantHeaderSamp, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__268)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__269 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantRecordFilt, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__269)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__271 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantRecordForm, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__271)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__272 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantRecordInfo, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__272)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__273 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantRecordSamp, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__273)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariantRecordSamp_2, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) __PYX_ERR(4, 1, __pyx_L1_error)
  __pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseIndex, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
  __pyx_umethod_PyBytes_Type_split.type = (PyObject*)&PyBytes_Type;
  __pyx_umethod_PyBytes_Type_split.method_name = &__pyx_n_s_split;
  __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_items.method_name = &__pyx_n_s_items;
  __pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_pop.method_name = &__pyx_n_s_pop;
  __pyx_umethod_PyUnicode_Type_format.type = (PyObject*)&PyUnicode_Type;
  __pyx_umethod_PyUnicode_Type_format.method_name = &__pyx_n_s_format;
  if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10091417 = PyInt_FromLong(10091417L); if (unlikely(!__pyx_int_10091417)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10698032 = PyInt_FromLong(10698032L); if (unlikely(!__pyx_int_10698032)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_31479882 = PyInt_FromLong(31479882L); if (unlikely(!__pyx_int_31479882)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_33440904 = PyInt_FromLong(33440904L); if (unlikely(!__pyx_int_33440904)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_39264352 = PyInt_FromLong(39264352L); if (unlikely(!__pyx_int_39264352)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_41264896 = PyInt_FromLong(41264896L); if (unlikely(!__pyx_int_41264896)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_93650198 = PyInt_FromLong(93650198L); if (unlikely(!__pyx_int_93650198)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_94171383 = PyInt_FromLong(94171383L); if (unlikely(!__pyx_int_94171383)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_97976187 = PyInt_FromLong(97976187L); if (unlikely(!__pyx_int_97976187)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_118286449 = PyInt_FromLong(118286449L); if (unlikely(!__pyx_int_118286449)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_126454353 = PyInt_FromLong(126454353L); if (unlikely(!__pyx_int_126454353)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_135711299 = PyInt_FromLong(135711299L); if (unlikely(!__pyx_int_135711299)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_145625440 = PyInt_FromLong(145625440L); if (unlikely(!__pyx_int_145625440)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_164668780 = PyInt_FromLong(164668780L); if (unlikely(!__pyx_int_164668780)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_168021462 = PyInt_FromLong(168021462L); if (unlikely(!__pyx_int_168021462)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_199651019 = PyInt_FromLong(199651019L); if (unlikely(!__pyx_int_199651019)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_215036767 = PyInt_FromLong(215036767L); if (unlikely(!__pyx_int_215036767)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_227765731 = PyInt_FromLong(227765731L); if (unlikely(!__pyx_int_227765731)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_232881935 = PyInt_FromLong(232881935L); if (unlikely(!__pyx_int_232881935)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_248899179 = PyInt_FromLong(248899179L); if (unlikely(!__pyx_int_248899179)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_250317299 = PyInt_FromLong(250317299L); if (unlikely(!__pyx_int_250317299)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4294967294 = PyInt_FromString((char *)"4294967294", 0, 0); if (unlikely(!__pyx_int_4294967294)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_globals ### */

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_module ### */

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_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(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  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_ptype_5pysam_7libcbcf_VariantHeader = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeader_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_vtabptr_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantHeader, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderRecord_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__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_n_s_VariantHeaderRecord, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderRecords_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantHeaderRecords, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderContigs_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantHeaderContigs, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderSamples_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantHeaderSamples, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantContig = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantContig_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantContig->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantContig->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantContig->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantContig->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantContig, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantMetadata = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantMetadata_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantMetadata, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata_spec, NULL); if (unlikely(!__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_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantHeaderMetadata, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecord_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecord)) __PYX_ERR(0, 3017, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecord_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecord, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordFilter_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter)) __PYX_ERR(0, 2236, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordFilter_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2236, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2236, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecordFilter, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2236, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2236, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordFormat_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat)) __PYX_ERR(0, 2398, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordFormat_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecordFormat, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordInfo_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo)) __PYX_ERR(0, 2533, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordInfo_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2533, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2533, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecordInfo, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2533, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2533, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordSamples_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples)) __PYX_ERR(0, 2867, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordSamples_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2867, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2867, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecordSamples, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2867, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2867, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSample = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordSample_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordSample)) __PYX_ERR(0, 3439, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordSample_spec, __pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3439, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3439, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantRecordSample, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3439, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3439, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_BaseIndex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BaseIndex_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_BaseIndex)) __PYX_ERR(0, 3662, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BaseIndex_spec, __pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3662, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3662, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseIndex, (PyObject *) __pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3662, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3662, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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_ptype_5pysam_7libcbcf_BCFIndex)) __PYX_ERR(0, 3751, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BCFIndex_spec, __pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3751, __pyx_L1_error)
  #else
  __pyx_ptype_5pysam_7libcbcf_BCFIndex = &__pyx_type_5pysam_7libcbcf_BCFIndex;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_base = __pyx_ptype_5pysam_7libcbcf_BaseIndex;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3751, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BCFIndex, (PyObject *) __pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3751, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3751, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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_ptype_5pysam_7libcbcf_TabixIndex)) __PYX_ERR(0, 3790, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_TabixIndex_spec, __pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3790, __pyx_L1_error)
  #else
  __pyx_ptype_5pysam_7libcbcf_TabixIndex = &__pyx_type_5pysam_7libcbcf_TabixIndex;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_base = __pyx_ptype_5pysam_7libcbcf_BaseIndex;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3790, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TabixIndex, (PyObject *) __pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3790, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3790, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_ptype_5pysam_7libcbcf_BaseIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BaseIterator_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_7libcbcf_BaseIterator)) __PYX_ERR(0, 3831, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BaseIterator_spec, __pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3831, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3831, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseIterator, (PyObject *) __pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3831, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3831, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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_ptype_5pysam_7libcbcf_BCFIterator)) __PYX_ERR(0, 3845, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BCFIterator_spec, __pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3845, __pyx_L1_error)
  #else
  __pyx_ptype_5pysam_7libcbcf_BCFIterator = &__pyx_type_5pysam_7libcbcf_BCFIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_base = __pyx_ptype_5pysam_7libcbcf_BaseIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3845, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BCFIterator, (PyObject *) __pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3845, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3845, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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_ptype_5pysam_7libcbcf_TabixIterator)) __PYX_ERR(0, 3931, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_TabixIterator_spec, __pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3931, __pyx_L1_error)
  #else
  __pyx_ptype_5pysam_7libcbcf_TabixIterator = &__pyx_type_5pysam_7libcbcf_TabixIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_base = __pyx_ptype_5pysam_7libcbcf_BaseIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3931, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TabixIterator, (PyObject *) __pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3931, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3931, __pyx_L1_error)
  #endif
  __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_ptype_5pysam_10libchtslib_HTSFile = __Pyx_ImportType_3_0_11(__pyx_t_1, "pysam.libchtslib", "HTSFile", sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_5pysam_10libchtslib_HTSFile),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__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_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_ptype_5pysam_10libchtslib_HTSFile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_ptype_5pysam_7libcbcf_VariantFile)) __PYX_ERR(0, 4033, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantFile_spec, __pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #else
  __pyx_ptype_5pysam_7libcbcf_VariantFile = &__pyx_type_5pysam_7libcbcf_VariantFile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_ptype_5pysam_7libcbcf_VariantFile->tp_base = __pyx_ptype_5pysam_10libchtslib_HTSFile;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf_VariantFile->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf_VariantFile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf_VariantFile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_vtabptr_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_MergeVtables(__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariantFile, (PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4033, __pyx_L1_error)
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 1281, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 1281, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__) < 0) __PYX_ERR(0, 1453, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__) < 0) __PYX_ERR(0, 1453, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__) < 0) __PYX_ERR(0, 1643, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__) < 0) __PYX_ERR(0, 1643, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_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_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__)) __PYX_ERR(0, 2321, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__) < 0) __PYX_ERR(0, 2321, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__) < 0) __PYX_ERR(0, 2321, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues)) __PYX_ERR(0, 2346, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues) < 0) __PYX_ERR(0, 2346, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues) < 0) __PYX_ERR(0, 2346, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems)) __PYX_ERR(0, 2351, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems) < 0) __PYX_ERR(0, 2351, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems) < 0) __PYX_ERR(0, 2351, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__)) __PYX_ERR(0, 2465, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__) < 0) __PYX_ERR(0, 2465, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__) < 0) __PYX_ERR(0, 2465, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues)) __PYX_ERR(0, 2494, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems)) __PYX_ERR(0, 2499, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems) < 0) __PYX_ERR(0, 2499, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems) < 0) __PYX_ERR(0, 2499, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__)) __PYX_ERR(0, 2671, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__) < 0) __PYX_ERR(0, 2671, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__) < 0) __PYX_ERR(0, 2671, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues)) __PYX_ERR(0, 2738, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues) < 0) __PYX_ERR(0, 2738, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues) < 0) __PYX_ERR(0, 2738, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems)) __PYX_ERR(0, 2756, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems) < 0) __PYX_ERR(0, 2756, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems) < 0) __PYX_ERR(0, 2756, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__)) __PYX_ERR(0, 2899, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__) < 0) __PYX_ERR(0, 2899, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__) < 0) __PYX_ERR(0, 2899, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues)) __PYX_ERR(0, 2936, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues) < 0) __PYX_ERR(0, 2936, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues) < 0) __PYX_ERR(0, 2936, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems)) __PYX_ERR(0, 2945, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems) < 0) __PYX_ERR(0, 2945, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems) < 0) __PYX_ERR(0, 2945, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__)) __PYX_ERR(0, 3477, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__) < 0) __PYX_ERR(0, 3477, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__) < 0) __PYX_ERR(0, 3477, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr)) __PYX_ERR(0, 3487, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr) < 0) __PYX_ERR(0, 3487, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr) < 0) __PYX_ERR(0, 3487, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr)) __PYX_ERR(0, 3492, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr) < 0) __PYX_ERR(0, 3492, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr) < 0) __PYX_ERR(0, 3492, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__)) __PYX_ERR(0, 3557, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__) < 0) __PYX_ERR(0, 3557, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__) < 0) __PYX_ERR(0, 3557, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues)) __PYX_ERR(0, 3586, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues) < 0) __PYX_ERR(0, 3586, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues) < 0) __PYX_ERR(0, 3586, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems)) __PYX_ERR(0, 3591, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems) < 0) __PYX_ERR(0, 3591, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems) < 0) __PYX_ERR(0, 3591, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues)) __PYX_ERR(0, 3701, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues) < 0) __PYX_ERR(0, 3701, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues) < 0) __PYX_ERR(0, 3701, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems)) __PYX_ERR(0, 3706, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_spec, __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems) < 0) __PYX_ERR(0, 3706, __pyx_L1_error)
  #else
  __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_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems) < 0) __PYX_ERR(0, 3706, __pyx_L1_error)
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_print = 0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_dictoffset && __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #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(void) {
  __Pyx_RefNannyDeclarations
  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_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__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_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__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, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 15, __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_ptype_7cpython_5array_array = __Pyx_ImportType_3_0_11(__pyx_t_1, "array", "array", sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(arrayobject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__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(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  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_0_11(__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_0_11(__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_0_11(__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_0_11(__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_0_11(__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_0_11(__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_0_11(__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 PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_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},
  {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_PEP489_MULTI_PHASE_INIT
      0, /* m_size */
    #elif CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstate), /* m_size */
    #else
      -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #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
#endif

#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initlibcbcf(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initlibcbcf(void)
#else
__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);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
#else
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)
#endif
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
#if CYTHON_COMPILING_IN_LIMITED_API
            result = PyModule_AddObject(module, to_name, value);
#else
            result = PyDict_SetItemString(moddict, to_name, value);
#endif
        }
        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 (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    moddict = module;
#else
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
#endif
    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
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __Pyx_TraceDeclarations
  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_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;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("libcbcf", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #elif CYTHON_USE_MODULE_STATE
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  {
    int add_module_result = PyState_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 = PyModule_Create(&__pyx_moduledef);
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #endif
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libcbcf(void)", 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_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init(__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
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_pysam__libcbcf) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "pysam.libcbcf")) {
      if (unlikely((PyDict_SetItemString(modules, "pysam.libcbcf", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_libcbcf(void)", __pyx_f[0], 1, 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_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_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_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_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 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_unquoted_str);
  __Pyx_GIVEREF(__pyx_n_s_unquoted_str);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_unquoted_str)) __PYX_ERR(0, 103, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_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_n_s_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_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 = PyList_New(22); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_VariantFile);
  __Pyx_GIVEREF(__pyx_n_u_VariantFile);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_VariantFile)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeader);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeader);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_VariantHeader)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeaderRecord);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeaderRecord);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_u_VariantHeaderRecord)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeaderRecords);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeaderRecords);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_u_VariantHeaderRecords)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantMetadata);
  __Pyx_GIVEREF(__pyx_n_u_VariantMetadata);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_u_VariantMetadata)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeaderMetadata);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeaderMetadata);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_u_VariantHeaderMetadata)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantContig);
  __Pyx_GIVEREF(__pyx_n_u_VariantContig);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_u_VariantContig)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeaderContigs);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeaderContigs);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_u_VariantHeaderContigs)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantHeaderSamples);
  __Pyx_GIVEREF(__pyx_n_u_VariantHeaderSamples);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_u_VariantHeaderSamples)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecordFilter);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecordFilter);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_u_VariantRecordFilter)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecordFormat);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecordFormat);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_u_VariantRecordFormat)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecordInfo);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecordInfo);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_u_VariantRecordInfo)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecordSamples);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecordSamples);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_u_VariantRecordSamples)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecord);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecord);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 13, __pyx_n_u_VariantRecord)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecordSample);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecordSample);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 14, __pyx_n_u_VariantRecordSample)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_BaseIndex);
  __Pyx_GIVEREF(__pyx_n_u_BaseIndex);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 15, __pyx_n_u_BaseIndex)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_BCFIndex);
  __Pyx_GIVEREF(__pyx_n_u_BCFIndex);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 16, __pyx_n_u_BCFIndex)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_TabixIndex);
  __Pyx_GIVEREF(__pyx_n_u_TabixIndex);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 17, __pyx_n_u_TabixIndex)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_BaseIterator);
  __Pyx_GIVEREF(__pyx_n_u_BaseIterator);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 18, __pyx_n_u_BaseIterator)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_BCFIterator);
  __Pyx_GIVEREF(__pyx_n_u_BCFIterator);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 19, __pyx_n_u_BCFIterator)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_TabixIterator);
  __Pyx_GIVEREF(__pyx_n_u_TabixIterator);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 20, __pyx_n_u_TabixIterator)) __PYX_ERR(0, 106, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_u_VariantRecord);
  __Pyx_GIVEREF(__pyx_n_u_VariantRecord);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 21, __pyx_n_u_VariantRecord)) __PYX_ERR(0, 106, __pyx_L1_error);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_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_tuple__279);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_VALUE_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_VALUE_TYPES, __pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);

  /* "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_tuple__280);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_METADATA_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_METADATA_TYPES, __pyx_tuple__280);
  __Pyx_GIVEREF(__pyx_tuple__280);

  /* "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_tuple__281);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS, __pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);

  /* "pysam/libcbcf.pyx":154
 * ########################################################################
 * 
 * cdef object _nothing = object()             # <<<<<<<<<<<<<<
 * 
 * ########################################################################
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); 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_n_s_VariantHeaderRecord_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_get, __pyx_t_3) < 0) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_keys, __pyx_t_3) < 0) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_items, __pyx_t_3) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_values, __pyx_t_3) < 0) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_n_s_VariantHeaderRecord_update, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_update, __pyx_t_3) < 0) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_k__41 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_5pysam_7libcbcf__nothing)) __PYX_ERR(0, 1376, __pyx_L1_error);
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_32pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecord_pop, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_pop, __pyx_t_2) < 0) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "pysam/libcbcf.pyx":1387
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_36remove, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecord_remove, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_n_s_remove, __pyx_t_2) < 0) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_38__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecord___reduce_cyt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_40__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecord___setstate_c, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1458
 *             yield makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 1458, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_12__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecords___reduce_cy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_14__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderRecords___setstate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_3remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantMetadata_remove_header, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_n_s_remove_header, __pyx_t_2) < 0) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantMetadata);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantMetadata___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantMetadata);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantMetadata___setstate_cytho, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_3add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_add, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_add, __pyx_t_2) < 0) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_remove_hea, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_remove_header, __pyx_t_2) < 0) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_clear_head, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_clear_header, __pyx_t_2) < 0) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "pysam/libcbcf.pyx":1668
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "pysam/libcbcf.pyx":1682
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "pysam/libcbcf.pyx":1690
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "pysam/libcbcf.pyx":1695
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 1695, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata___reduce_c, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderMetadata___setstate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_3remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantContig_remove_header, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_n_s_remove_header, __pyx_t_2) < 0) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantContig);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantContig___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantContig);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantContig___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantContig);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_remove_head, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_remove_header, __pyx_t_2) < 0) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_clear_heade, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_clear_header, __pyx_t_2) < 0) __PYX_ERR(0, 1818, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_16get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "pysam/libcbcf.pyx":1848
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "pysam/libcbcf.pyx":1862
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_28keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 1862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_30items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "pysam/libcbcf.pyx":1870
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_32values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "pysam/libcbcf.pyx":1875
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 1875, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_34add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs_add, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_add, __pyx_t_2) < 0) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs___reduce_cy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderContigs___setstate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);

  /* "pysam/libcbcf.pyx":1938
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 1938, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);

  /* "pysam/libcbcf.pyx":1942
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample"""
 *         self.header.add_sample(name)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_14add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderSamples_add, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_n_s_add, __pyx_t_2) < 0) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_16__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderSamples___reduce_cy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_18__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeaderSamples___setstate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);

  /* "pysam/libcbcf.pyx":1981
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_9copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_copy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_11merge, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_merge, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_merge, __pyx_t_2) < 0) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_15new_record, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_new_record, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__300);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_new_record, __pyx_t_2) < 0) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_17add_record, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_add_record, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_add_record, __pyx_t_2) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_19add_line, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_add_line, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_add_line, __pyx_t_2) < 0) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_21add_meta, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_add_meta, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__304);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_add_meta, __pyx_t_2) < 0) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "pysam/libcbcf.pyx":2184
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
 *     def add_sample(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_23add_sample, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_add_sample, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_add_sample, __pyx_t_2) < 0) __PYX_ERR(0, 2184, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "pysam/libcbcf.pyx":2189
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_25add_samples, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader_add_samples, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_n_s_add_samples, __pyx_t_2) < 0) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantHeader);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_27__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_29__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantHeader___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__110)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2273
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_9add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_add, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__112)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_add, __pyx_t_2) < 0) __PYX_ERR(0, 2273, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2315
 *         bcf_remove_filter(hdr, r, id, 0)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_clear, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2329
 *             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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 2329, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2342
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 2342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2346
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2351
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2356
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2360
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2364
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__120)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2383
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 2383, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_38__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter___reduce_cyt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__121)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_40__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFilter___setstate_c, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);

  /* "pysam/libcbcf.pyx":2449
 *             raise ValueError('Unable to delete FORMAT')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_11clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_clear, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 2449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2476
 *                 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_16get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__126)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2490
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2494
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_22itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2499
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2504
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_28keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 2504, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2508
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_30items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2512
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_32values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2517
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 2517, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_34__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat___reduce_cyt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_36__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordFormat___setstate_c, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);

  /* "pysam/libcbcf.pyx":2651
 *             raise ValueError('Unable to delete INFO')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_clear, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__137)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 2651, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2688
 *                     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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 2688, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2734
 *         return info != NULL and info.vptr != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2738
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2756
 *                     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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 2756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2775
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2779
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 2779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2783
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2787
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_36update, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_update, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__145)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_update, __pyx_t_2) < 0) __PYX_ERR(0, 2787, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2801
 *                 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_k__146 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_5pysam_7libcbcf__nothing)) __PYX_ERR(0, 2801, __pyx_L1_error);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_38pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordInfo_pop, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__147)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_pop, __pyx_t_3) < 0) __PYX_ERR(0, 2801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2854
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 2854, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "(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_n_s_VariantRecordInfo___reduce_cytho, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "(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_n_s_VariantRecordInfo___setstate_cyt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__149)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);

  /* "pysam/libcbcf.pyx":2907
 *             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_n_s_VariantRecordSamples_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_get, __pyx_t_3) < 0) __PYX_ERR(0, 2907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2932
 *         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_n_s_VariantRecordSamples_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__151)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 2932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2936
 *         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_n_s_VariantRecordSamples_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 2936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2945
 *             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_n_s_VariantRecordSamples_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__153)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 2945, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2954
 *             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_n_s_VariantRecordSamples_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__154)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_keys, __pyx_t_3) < 0) __PYX_ERR(0, 2954, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2958
 *         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_n_s_VariantRecordSamples_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__155)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_items, __pyx_t_3) < 0) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2962
 *         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_n_s_VariantRecordSamples_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__156)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_values, __pyx_t_3) < 0) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2966
 *         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_n_s_VariantRecordSamples_update, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__157)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_update, __pyx_t_3) < 0) __PYX_ERR(0, 2966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":2978
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_k__158 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_5pysam_7libcbcf__nothing)) __PYX_ERR(0, 2978, __pyx_L1_error);
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_32pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSamples_pop, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__159)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_pop, __pyx_t_2) < 0) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":3003
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 3003, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSamples___reduce_cy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__160)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSamples___setstate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__161)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);

  /* "pysam/libcbcf.pyx":3027
 *             self.ptr = NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_5copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecord_copy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__162)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecord, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecord);

  /* "pysam/libcbcf.pyx":3031
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_7translate, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecord_translate, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__163)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecord, __pyx_n_s_translate, __pyx_t_2) < 0) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecord);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecord___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__178)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecord___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3545
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_clear, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__184)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 3545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3568
 *                 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 3568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3582
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__186)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_iterkeys, __pyx_t_2) < 0) __PYX_ERR(0, 3582, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3586
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__187)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_itervalues, __pyx_t_2) < 0) __PYX_ERR(0, 3586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3591
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__188)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_iteritems, __pyx_t_2) < 0) __PYX_ERR(0, 3591, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3596
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__189)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_keys, __pyx_t_2) < 0) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3600
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__190)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_items, __pyx_t_2) < 0) __PYX_ERR(0, 3600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3604
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_values, __pyx_t_2) < 0) __PYX_ERR(0, 3604, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3608
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_36update, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_update, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__192)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_update, __pyx_t_2) < 0) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3620
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_k__193 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_5pysam_7libcbcf__nothing)) __PYX_ERR(0, 3620, __pyx_L1_error);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_38pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantRecordSample_pop, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__194)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_pop, __pyx_t_3) < 0) __PYX_ERR(0, 3620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3642
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 3642, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "(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_n_s_VariantRecordSample___reduce_cyt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__195)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "(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_n_s_VariantRecordSample___setstate_c, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__196)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);

  /* "pysam/libcbcf.pyx":3682
 *         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_n_s_BaseIndex_get, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__198)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_get, __pyx_t_3) < 0) __PYX_ERR(0, 3682, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3697
 *             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_n_s_BaseIndex_iterkeys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__199)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 3697, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3701
 *         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_n_s_BaseIndex_itervalues, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__200)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3706
 *             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_n_s_BaseIndex_iteritems, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__201)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 3706, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3711
 *             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_n_s_BaseIndex_keys, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__202)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_keys, __pyx_t_3) < 0) __PYX_ERR(0, 3711, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3715
 *         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_n_s_BaseIndex_items, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__203)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_items, __pyx_t_3) < 0) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3719
 *         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_n_s_BaseIndex_values, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__204)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_values, __pyx_t_3) < 0) __PYX_ERR(0, 3719, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3723
 *         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_n_s_BaseIndex_update, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__205)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_update, __pyx_t_3) < 0) __PYX_ERR(0, 3723, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3735
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
 */
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_k__206 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_5pysam_7libcbcf__nothing)) __PYX_ERR(0, 3735, __pyx_L1_error);
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_31pop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseIndex_pop, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__207)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_pop, __pyx_t_2) < 0) __PYX_ERR(0, 3735, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3746
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_hash, Py_None) < 0) __PYX_ERR(0, 3746, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseIndex___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__208)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseIndex___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__209)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BaseIndex);

  /* "pysam/libcbcf.pyx":3771
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, reopen)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_5fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BCFIndex_fetch, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__211)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_BCFIndex, __pyx_n_s_fetch, __pyx_t_2) < 0) __PYX_ERR(0, 3771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_BCFIndex);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BCFIndex___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__212)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BCFIndex___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__213)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3810
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, reopen)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_5fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TabixIndex_fetch, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__214)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_TabixIndex, __pyx_n_s_fetch, __pyx_t_2) < 0) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_TabixIndex);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TabixIndex___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__215)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TabixIndex___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_12BaseIterator_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseIterator___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__217)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_12BaseIterator_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BaseIterator___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__218)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11BCFIterator_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BCFIterator___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__225)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11BCFIterator_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BCFIterator___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__226)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13TabixIterator_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TabixIterator___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__229)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13TabixIterator_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TabixIterator___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":4135
 *                 raise IOError(errno, force_str(strerror(errno)))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_7close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_close, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__231)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_close, __pyx_t_2) < 0) __PYX_ERR(0, 4135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4197
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_13copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_copy, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__235)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 4197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4235
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_15open, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_open, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__237)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__320);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_open, __pyx_t_2) < 0) __PYX_ERR(0, 4235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4380
 *             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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_17reset, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_reset, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__243)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_reset, __pyx_t_2) < 0) __PYX_ERR(0, 4380, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4384
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_19is_valid_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_is_valid_tid, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__244)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_is_valid_tid, __pyx_t_2) < 0) __PYX_ERR(0, 4384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4397
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 *     def get_tid(self, reference):             # <<<<<<<<<<<<<<
 *         """
 *         return the numerical :term:`tid` corresponding to
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_21get_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_get_tid, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__245)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_get_tid, __pyx_t_2) < 0) __PYX_ERR(0, 4397, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4412
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_23get_reference_name, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_get_reference_name, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__246)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_get_reference_name, __pyx_t_2) < 0) __PYX_ERR(0, 4412, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4425
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_25fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_fetch, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__248)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__325);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_fetch, __pyx_t_2) < 0) __PYX_ERR(0, 4425, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4471
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
 *     def new_record(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Create a new empty :class:`VariantRecord`.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_27new_record, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_new_record, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__251)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_new_record, __pyx_t_2) < 0) __PYX_ERR(0, 4471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4478
 *         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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_29write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_write, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__252)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_write, __pyx_t_2) < 0) __PYX_ERR(0, 4478, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "pysam/libcbcf.pyx":4519
 *         return ret
 * 
 *     def subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         """
 *         Read only a subset of samples to reduce processing time and memory.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_31subset_samples, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile_subset_samples, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__254)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_n_s_subset_samples, __pyx_t_2) < 0) __PYX_ERR(0, 4519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5pysam_7libcbcf_VariantFile);

  /* "(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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile___reduce_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__257)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_VariantFile___setstate_cython, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__258)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords, 0, __pyx_n_s_pyx_unpickle_VariantHeaderReco, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__259)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantHeaderReco, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata, 0, __pyx_n_s_pyx_unpickle_VariantMetadata, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__261)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantMetadata, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata, 0, __pyx_n_s_pyx_unpickle_VariantHeaderMeta, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__263)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantHeaderMeta, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_7__pyx_unpickle_VariantContig, 0, __pyx_n_s_pyx_unpickle_VariantContig, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__265)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantContig, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs, 0, __pyx_n_s_pyx_unpickle_VariantHeaderCont, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__267)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantHeaderCont, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples, 0, __pyx_n_s_pyx_unpickle_VariantHeaderSamp, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__268)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantHeaderSamp, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter, 0, __pyx_n_s_pyx_unpickle_VariantRecordFilt, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__269)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantRecordFilt, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat, 0, __pyx_n_s_pyx_unpickle_VariantRecordForm, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__271)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantRecordForm, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo, 0, __pyx_n_s_pyx_unpickle_VariantRecordInfo, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__272)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantRecordInfo, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples, 0, __pyx_n_s_pyx_unpickle_VariantRecordSamp, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__273)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantRecordSamp, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample, 0, __pyx_n_s_pyx_unpickle_VariantRecordSamp_2, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__274)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariantRecordSamp_2, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex, 0, __pyx_n_s_pyx_unpickle_BaseIndex, NULL, __pyx_n_s_pysam_libcbcf, __pyx_d, ((PyObject *)__pyx_codeobj__276)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseIndex, __pyx_t_2) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1
 * # cython: language_level=3             # <<<<<<<<<<<<<<
 * # cython: embedsignature=True
 * # cython: profile=True
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_TraceReturn(Py_None, 0);

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__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;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}
/* #### 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);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    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);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError */
#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
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 >= 0x030d00A1
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    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_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* TupleAndListFromArray */
#if 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) {
        Py_INCREF(__pyx_empty_tuple);
        return __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
    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
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
    for (i = 0; i < n; i++)
    {
        if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
    PyObject *dict;
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
        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
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   PyThreadState* tstate,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno) {
    PyObject *type, *value, *traceback;
    int retval;
    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
        if (*code == NULL) {
            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
            if (*code == NULL) return 0;
        }
        *frame = PyFrame_New(
            tstate,                          /*PyThreadState *tstate*/
            *code,                           /*PyCodeObject *code*/
            __pyx_d,                  /*PyObject *globals*/
            0                                /*PyObject *locals*/
        );
        if (*frame == NULL) return 0;
        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
            Py_INCREF(Py_None);
            (*frame)->f_trace = Py_None;
        }
#if PY_VERSION_HEX < 0x030400B1
    } else {
        (*frame)->f_tstate = tstate;
#endif
    }
    __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
    retval = 1;
    __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 (retval) {
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
        return __Pyx_IsTracing(tstate, 0, 0) && retval;
    } else {
        Py_XDECREF(type);
        Py_XDECREF(value);
        Py_XDECREF(traceback);
        return -1;
    }
}
static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyCodeObject *py_code = 0;
#if PY_MAJOR_VERSION >= 3
    py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
    if (likely(py_code)) {
        py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
    }
#else
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    py_funcname = PyString_FromString(funcname);
    if (unlikely(!py_funcname)) goto bad;
    py_srcfile = PyString_FromString(srcfile);
    if (unlikely(!py_srcfile)) goto bad;
    py_code = PyCode_New(
        0,
        0,
        0,
        CO_OPTIMIZED | CO_NEWLOCALS,
        __pyx_empty_bytes,     /*PyObject *code,*/
        __pyx_empty_tuple,     /*PyObject *consts,*/
        __pyx_empty_tuple,     /*PyObject *names,*/
        __pyx_empty_tuple,     /*PyObject *varnames,*/
        __pyx_empty_tuple,     /*PyObject *freevars,*/
        __pyx_empty_tuple,     /*PyObject *cellvars,*/
        py_srcfile,       /*PyObject *filename,*/
        py_funcname,      /*PyObject *name,*/
        firstlineno,
        __pyx_empty_bytes      /*PyObject *lnotab*/
    );
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
#endif
    return py_code;
}
#endif

/* DivInt[long] */
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* 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 PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    #endif
    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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
        
            x = (long)((unsigned long)a + (unsigned long)b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        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
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
            double result;
            
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    __Pyx_PyThreadState_declare
    CYTHON_UNUSED_VAR(cause);
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
      #if 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;
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C00A6
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
  #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
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
    if (unlikely(tstate->current_exception))
#elif CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #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);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc;
    __Pyx_PyThreadState_declare
    #ifdef __Pyx_StopAsyncIteration_USED
    int is_async_stopiteration = 0;
    #endif
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    cur_exc = PyErr_Occurred();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        #ifdef __Pyx_StopAsyncIteration_USED
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else
        #endif
            return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(val);
    Py_XDECREF(tb);
    PyErr_SetString(PyExc_RuntimeError,
        #ifdef __Pyx_StopAsyncIteration_USED
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        #endif
        "generator raised StopIteration");
}

/* 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 CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* UnpackUnboundCMethod */
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;
}
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
     METH_VARARGS | METH_KEYWORDS,
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #else
    if (likely(!__Pyx_CyOrPyCFunction_Check(method)))
    #endif
    {
        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);
            target->method = unbound_method;
        }
    }
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            #else
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            #endif
        } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *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)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(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;
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **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;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    #if PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
        return NULL;
    }
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
        return NULL;
    }
    #endif
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    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 PY_MAJOR_VERSION < 3
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    #else
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    #endif
    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 **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
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **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 PY_VERSION_HEX >= 0x030700A1
    if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
        return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
    }
    #endif
    #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
        #if PY_VERSION_HEX < 0x03090000
        vectorcallfunc f = _PyVectorcall_Function(func);
        #else
        vectorcallfunc f = PyVectorcall_Function(func);
        #endif
        if (f) {
            return f(func, args, (size_t)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, (size_t)nargs, NULL);
        }
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __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
}

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

/* 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))
#elif PY_MAJOR_VERSION >= 3
        #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
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #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_GetName(tp);
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
#else
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
                 type_name, PyString_AS_STRING(name));
#endif
    __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 >= 0x030C00A2)
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 >= 0x030C00A2
    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_n_s_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 = PyInt_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_AVOID_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, PyInt_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_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, PyInt_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_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))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    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 = PyInt_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, PyInt_FromSsize_t(i));
}

/* StringJoin */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    (void) __Pyx_PyObject_CallMethod1;
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION < 3
    return _PyString_Join(sep, values);
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    return _PyBytes_Join(sep, values);
#else
    return __Pyx_PyObject_CallMethod1(sep, __pyx_n_s_join, values);
#endif
}

/* PyIntCompare */
static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 0;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        return (a != b);
    }
    #endif
    #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;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
        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);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kw,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
        Py_ssize_t kwsize;
#if CYTHON_ASSUME_SAFE_MACROS
        kwsize = PyTuple_GET_SIZE(kw);
#else
        kwsize = PyTuple_Size(kw);
        if (kwsize < 0) return 0;
#endif
        if (unlikely(kwsize == 0))
            return 1;
        if (!kw_allowed) {
#if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, 0);
#else
            key = PyTuple_GetItem(kw, pos);
            if (!key) return 0;
#endif
            goto invalid_keyword;
        }
#if PY_VERSION_HEX < 0x03090000
        for (pos = 0; pos < kwsize; pos++) {
#if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
#else
            key = PyTuple_GetItem(kw, pos);
            if (!key) return 0;
#endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
        }
#endif
        return 1;
    }
    while (PyDict_Next(kw, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if (!kw_allowed && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    #if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_TypeError,
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject *const *kwvalues,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
    while (1) {
        Py_XDECREF(key); key = NULL;
        Py_XDECREF(value); value = NULL;
        if (kwds_is_tuple) {
            Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS
            size = PyTuple_GET_SIZE(kwds);
#else
            size = PyTuple_Size(kwds);
            if (size < 0) goto bad;
#endif
            if (pos >= size) break;
#if CYTHON_AVOID_BORROWED_REFS
            key = __Pyx_PySequence_ITEM(kwds, pos);
            if (!key) goto bad;
#elif CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kwds, pos);
#else
            key = PyTuple_GetItem(kwds, pos);
            if (!key) goto bad;
#endif
            value = kwvalues[pos];
            pos++;
        }
        else
        {
            if (!PyDict_Next(kwds, &pos, &key, &value)) break;
#if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(key);
#endif
        }
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
#if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(value);
            Py_DECREF(key);
#endif
            key = NULL;
            value = NULL;
            continue;
        }
#if !CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(key);
#endif
        Py_INCREF(value);
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
#if CYTHON_AVOID_BORROWED_REFS
                    value = NULL;
#endif
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key)
                );
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
#if CYTHON_AVOID_BORROWED_REFS
                    value = NULL;
#endif
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    Py_XDECREF(key);
    Py_XDECREF(value);
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    #if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_TypeError,
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    Py_XDECREF(key);
    Py_XDECREF(value);
    return -1;
}

/* 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_GetName(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_n_s_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetName(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

/* 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 if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = 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_COMPILING_IN_PYPY
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 && PY_MAJOR_VERSION >= 3
#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;
#elif PY_MAJOR_VERSION >= 3
        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);
}
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) {
        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);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } 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 < 0x030d00A1
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 >= 0x030d00A1
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyString_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_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#elif CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_items */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
    else
        return PyDict_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
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
#endif
    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);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    type_name = __Pyx_PyType_GetName(type);
    obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *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)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* py_dict_pop */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3 & PY_VERSION_HEX < 0x030d0000
    if ((1)) {
        return _PyDict_Pop(d, key, default_value);
    } else
#endif
    if (default_value) {
        return __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_pop, d, key, default_value);
    } else {
        return __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_pop, d, key);
    }
}

/* 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_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)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            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 = PyInt_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, PyInt_FromSsize_t(i), v);
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
        
            x = (long)((unsigned long)a - (unsigned long)b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        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
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
#if CYTHON_COMPILING_IN_LIMITED_API
        double a = __pyx_PyFloat_AsDouble(op1);
#else
        double a = PyFloat_AS_DOUBLE(op1);
#endif
            double result;
            
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* RaiseClosureNameError */
static CYTHON_INLINE 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_GetName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetName(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, int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#else
    CYTHON_UNUSED_VAR(wraparound);
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#else
    CYTHON_UNUSED_VAR(wraparound);
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetName(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;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (unlikely(!py_import))
        goto bad;
    if (!from_list) {
        empty_list = PyList_New(0);
        if (unlikely(!empty_list))
            goto bad;
        from_list = empty_list;
    }
    #endif
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
                module = PyImport_ImportModuleLevelObject(
                    name, __pyx_d, empty_dict, from_list, 1);
                if (unlikely(!module)) {
                    if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (unlikely(!py_level))
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, __pyx_d, empty_dict, from_list, level);
            #endif
        }
    }
bad:
    Py_XDECREF(empty_dict);
    Py_XDECREF(empty_list);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    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_kp_u__52);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400)
        {
            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,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (!r) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

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

/* FixUpExtensionType */
#if CYTHON_USE_TYPE_SPECS
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
#else
    const PyType_Slot *slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
        int changed = 0;
#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
        const
#endif
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
#if PY_VERSION_HEX < 0x030900b1
                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
#else
                if ((0));
#endif
#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
                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;
                    if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
                        Py_DECREF(descr);
                        return -1;
                    }
                    Py_DECREF(descr);
                    changed = 1;
                }
#endif
            }
            memb++;
        }
        if (changed)
            PyType_Modified(type);
    }
#endif
    return 0;
}
#endif

/* 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_MACROS
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (n < 0) return -1;
#endif
    for (i = 1; i < n; i++)
    {
#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
        PyTypeObject *b;
#if PY_MAJOR_VERSION < 3
        if (PyClass_Check(b0))
        {
            PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
                         PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetName(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 || CYTHON_COMPILING_IN_PYPY
            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_GetName(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 || CYTHON_COMPILING_IN_PYPY)
              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 */
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || 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;
    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 PY_VERSION_HEX >= 0x03050000 && !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 PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
        gc = PyImport_GetModule(__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __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_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 PY_VERSION_HEX >= 0x03050000 && !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_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
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, attr_name);
#else
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
                 type_name, PyString_AS_STRING(attr_name));
#endif
    __Pyx_DECREF_TypeName(type_name);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
static int __Pyx_SetVtable(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_n_s_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_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_n_s_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_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 */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i;
    void** base_vtables;
    __Pyx_TypeName tp_base_name;
    __Pyx_TypeName base_name;
    void* unknown = (void*)-1;
    PyObject* bases = type->tp_bases;
    int base_depth = 0;
    {
        PyTypeObject* base = type->tp_base;
        while (base) {
            base_depth += 1;
            base = base->tp_base;
        }
    }
    base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
    for (i = 1; i < PyTuple_GET_SIZE(bases); i++) {
        void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i)));
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = type->tp_base;
            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 = base->tp_base;
            }
        }
    }
    PyErr_Clear();
    free(base_vtables);
    return 0;
bad:
    tp_base_name = __Pyx_PyType_GetName(type->tp_base);
    base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i));
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
    free(base_vtables);
    return -1;
}
#endif

/* SetupReduce */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_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_n_s_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_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_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_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_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_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_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_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_GetName((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;
}
#endif

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_0_11
#define __PYX_HAVE_RT_ImportType_3_0_11
static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
{
    PyObject *result = 0;
    char warning[200];
    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
    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_0_11 &&
            ((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_0_11 && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* ImportDottedModule */
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
    PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
    if (unlikely(PyErr_Occurred())) {
        PyErr_Clear();
    }
    if (likely(PyTuple_GET_SIZE(parts_tuple) == 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(
#if PY_MAJOR_VERSION < 3
        PyExc_ImportError,
        "No module named '%s'", PyString_AS_STRING(partial_name));
#else
#if PY_VERSION_HEX >= 0x030600B1
        PyExc_ModuleNotFoundError,
#else
        PyExc_ImportError,
#endif
        "No module named '%U'", partial_name);
#endif
bad:
    Py_XDECREF(sep);
    Py_XDECREF(slice);
    Py_XDECREF(partial_name);
    return NULL;
}
#endif
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
    PyObject *imported_module;
#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400)
    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;
}
#endif
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
    Py_ssize_t i, nparts;
    nparts = PyTuple_GET_SIZE(parts_tuple);
    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 = PySequence_ITEM(parts_tuple, i);
#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;
}
#endif
static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if PY_MAJOR_VERSION < 3
    PyObject *module, *from_list, *star = __pyx_n_s__278;
    CYTHON_UNUSED_VAR(parts_tuple);
    from_list = PyList_New(1);
    if (unlikely(!from_list))
        return NULL;
    Py_INCREF(star);
    PyList_SET_ITEM(from_list, 0, star);
    module = __Pyx_Import(name, from_list, 0);
    Py_DECREF(from_list);
    return module;
#else
    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);
#endif
}
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
    PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(module)) {
        PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
        if (likely(spec)) {
            PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_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);
}

/* FetchSharedCythonModule */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
}

/* FetchCommonType */
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t basicsize,
                               Py_ssize_t expected_basicsize) {
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
#if !CYTHON_USE_TYPE_SPECS
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* abi_module;
    const char* object_name;
    PyTypeObject *cached_type = NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) return NULL;
    object_name = strrchr(type->tp_name, '.');
    object_name = object_name ? object_name+1 : type->tp_name;
    cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
    if (cached_type) {
        if (__Pyx_VerifyCachedType(
              (PyObject *)cached_type,
              object_name,
              cached_type->tp_basicsize,
              type->tp_basicsize) < 0) {
            goto bad;
        }
        goto done;
    }
    if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
    PyErr_Clear();
    if (PyType_Ready(type) < 0) goto bad;
    if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
        goto bad;
    Py_INCREF(type);
    cached_type = type;
done:
    Py_DECREF(abi_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}
#else
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module, *cached_type = NULL;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) return NULL;
    cached_type = PyObject_GetAttrString(abi_module, object_name);
    if (cached_type) {
        Py_ssize_t basicsize;
#if CYTHON_COMPILING_IN_LIMITED_API
        PyObject *py_basicsize;
        py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
        if (unlikely(!py_basicsize)) goto bad;
        basicsize = PyLong_AsSsize_t(py_basicsize);
        Py_DECREF(py_basicsize);
        py_basicsize = 0;
        if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
#else
        basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
#endif
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              basicsize,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    }
    if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
    PyErr_Clear();
    CYTHON_UNUSED_VAR(module);
    cached_type = __Pyx_PyType_FromModuleAndSpec(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;
    if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
done:
    Py_DECREF(abi_module);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}
#endif

/* PyVectorcallFastCallDict */
#if CYTHON_METH_FASTCALL
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;
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    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 &= Py_TYPE(key)->tp_flags;
        Py_INCREF(key);
        Py_INCREF(value);
        PyTuple_SET_ITEM(kwnames, i, key);
        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)
{
    if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
        return vc(func, args, nargs, NULL);
    }
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
    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;
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
    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(__pyx_CyFunctionObject *op, void *closure)
{
    CYTHON_UNUSED_VAR(closure);
    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) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
#endif
            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 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_Py_XDECREF_SET(op->func_doc, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#elif PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#else
        op->func_name = PyString_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 int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
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_Py_XDECREF_SET(op->func_dict, value);
    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_Py_XDECREF_SET(op->defaults_tuple, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->defaults_tuple;
    CYTHON_UNUSED_VAR(context);
    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 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_Py_XDECREF_SET(op->defaults_kwdict, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->defaults_kwdict;
    CYTHON_UNUSED_VAR(context);
    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 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_Py_XDECREF_SET(op->func_annotations, value);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = op->func_annotations;
    CYTHON_UNUSED_VAR(context);
    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_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    int is_coroutine;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
#if PY_VERSION_HEX >= 0x03050000
    if (is_coroutine) {
        PyObject *module, *fromlist, *marker = __pyx_n_s_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_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(op->func_is_coroutine)) {
            return __Pyx_NewRef(op->func_is_coroutine);
        }
ignore:
        PyErr_Clear();
    }
#endif
    op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
    return __Pyx_NewRef(op->func_is_coroutine);
}
#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[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {(char *) "_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
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if CYTHON_USE_TYPE_SPECS
    {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#if CYTHON_METH_FASTCALL
#if CYTHON_BACKPORT_VECTORCALL
    {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
#if !CYTHON_COMPILING_IN_LIMITED_API
    {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#endif
#endif
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {(char *) "__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)
{
    CYTHON_UNUSED_VAR(args);
#if PY_MAJOR_VERSION >= 3
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#else
    return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0 || 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_pyobjects = 0;
    op->defaults_size = 0;
    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);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __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)
{
    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);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
#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);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyObject *py_name = NULL;
    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*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_MACROS
            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);
#if CYTHON_COMPILING_IN_LIMITED_API
            py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
            if (!py_name) return NULL;
            PyErr_Format(PyExc_TypeError,
                "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                py_name, size);
            Py_DECREF(py_name);
#else
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
#endif
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_MACROS
            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;
            }
#if CYTHON_COMPILING_IN_LIMITED_API
            py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
            if (!py_name) return NULL;
            PyErr_Format(PyExc_TypeError,
                "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                py_name, size);
            Py_DECREF(py_name);
#else
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
#endif
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
    if (!py_name) return NULL;
    PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
                 py_name);
    Py_DECREF(py_name);
#else
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
#endif
    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
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS
        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_MACROS
        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);
#if PY_MAJOR_VERSION > 2
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
#else
            PyErr_SetString(PyExc_TypeError,
                            "unbound method needs an argument");
#endif
            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
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)) {
            PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
                         ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
        PyErr_Format(PyExc_TypeError,
                     "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
        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;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
            def->ml_name, nargs);
        return NULL;
    }
    return def->ml_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;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
            def->ml_name, nargs);
        return NULL;
    }
    return def->ml_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;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_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;
    PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
    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;
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
        self = ((PyCFunctionObject*)cyfunc)->m_self;
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
}
#endif
#if CYTHON_USE_TYPE_SPECS
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 (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
#else
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
#if !CYTHON_METH_FASTCALL
    0,
#elif CYTHON_BACKPORT_VECTORCALL
    (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
#else
    offsetof(PyCFunctionObject, vectorcall),
#endif
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_PyMethod_New,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if PY_VERSION_HEX >= 0x030d00A4
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
static int __pyx_CyFunction_init(PyObject *module) {
#if CYTHON_USE_TYPE_SPECS
    __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
#else
    CYTHON_UNUSED_VAR(module);
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
#endif
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    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_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
#if !CYTHON_COMPILING_IN_LIMITED_API
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}
#endif

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  #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;
        result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    #if __PYX_LIMITED_VERSION_HEX < 0x030780000
    {
        PyObject *compiled = NULL, *result = NULL;
        if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
        if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
        compiled = Py_CompileString(
            "out = type(code)(\n"
            "  code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
            "  code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
            "  code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
            "  code.co_lnotab)\n", "<dummy>", Py_file_input);
        if (!compiled) return NULL;
        result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
        Py_DECREF(compiled);
        if (!result) PyErr_Print();
        Py_DECREF(result);
        result = PyDict_GetItemString(scratch_dict, "out");
        if (result) Py_INCREF(result);
        return result;
    }
    #else
    return NULL;
    #endif
}
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 = 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;
    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 PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        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;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    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_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int32_t __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int32_t) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int32_t) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyInt_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_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(long) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int8_t __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int8_t) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int8_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int8_t) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        int8_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int8_t) -1;
        val = __Pyx_PyInt_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_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int16_t) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int16_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int16_t) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        int16_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int16_t) -1;
        val = __Pyx_PyInt_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE uint32_t __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(uint32_t) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint32_t) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyInt_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if ((sizeof(int64_t) < sizeof(long))) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    }
#endif
    if (unlikely(!PyLong_Check(x))) {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_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_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_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;
        PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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;
        arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
        if (!arg_tuple) goto limited_bad;
        if (!is_unsigned) {
            kwds = PyDict_New();
            if (!kwds) goto limited_bad;
            if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
        }
        result = PyObject_Call(from_bytes, arg_tuple, kwds);
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(arg_tuple);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API
static __Pyx_TypeName
__Pyx_PyType_GetName(PyTypeObject* tp)
{
    PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_n_s_name_2);
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
        PyErr_Clear();
        Py_XDECREF(name);
        name = __Pyx_NewRef(__pyx_n_s__330);
    }
    return name;
}
#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);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CoroutineBase */
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) 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;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#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 PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
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);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(PyObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
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(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#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_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
    self->is_running = 1;
    retval = self->body(self, tstate, value);
    self->is_running = 0;
#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
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY
    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
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
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
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #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 && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval))
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    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);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        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)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
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 = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        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)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        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_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    gen->is_running = 0;
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                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);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, (char *)"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) {
    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);
    Py_CLEAR(gen->yieldfrom);
    __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 PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        Py_TYPE(gen)->tp_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);
}
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;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __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 PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (likely(--self->ob_refcnt == 0)) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#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 PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    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 PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context)
{
    PyObject *frame = self->gi_frame;
    CYTHON_UNUSED_VAR(context);
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
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;
    #if PY_VERSION_HEX >= 0x030B00a4
    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;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (unlikely(!module)) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) 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,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if CYTHON_USE_TYPE_SPECS
    {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
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 *) __Pyx_PyObject_GenericGetAttrNoDict},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    __pyx_GeneratorType_slots
};
#else
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if __PYX_NEED_TP_PRINT_SLOT
    0,
#endif
#if PY_VERSION_HEX >= 0x030C0000
    0,
#endif
#if PY_VERSION_HEX >= 0x030d00A4
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
    0,
#endif
};
#endif
static int __pyx_Generator_init(PyObject *module) {
#if CYTHON_USE_TYPE_SPECS
    __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL);
#else
    CYTHON_UNUSED_VAR(module);
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
#endif
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
    return Py_Version & ~0xFFUL;
#else
    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;
    }
    return version;
#endif
}
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_0_11
#define __PYX_HAVE_RT_ImportFunction_3_0_11
static int __Pyx_ImportFunction_3_0_11(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, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    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);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
#if PY_MAJOR_VERSION >= 3
static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
    if (t.is_unicode | t.is_str) {
        if (t.intern) {
            *str = PyUnicode_InternFromString(t.s);
        } else if (t.encoding) {
            *str = PyUnicode_Decode(t.s, t.n - 1, 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;
    if (PyObject_Hash(*str) == -1)
        return -1;
    return 0;
}
#endif
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION >= 3
        __Pyx_InitString(*t, t->p);
        #else
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        #endif
        ++t;
    }
    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_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
#if PY_MAJOR_VERSION >= 3
    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;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
                 type_name, type_name, result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    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 = PyInt_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);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */