/* Generated by Cython 0.21.1 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_21_1"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #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_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#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)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#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))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? 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
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if 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
#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
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
#endif


#if PY_MAJOR_VERSION >= 3
  #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_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__pysam__cbcf
#define __PYX_HAVE_API__pysam__cbcf
#include "stdint.h"
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "sys/types.h"
#include "zlib.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 "pysam_stream.h"
#include "htslib/faidx.h"
#include "htslib/tbx.h"
#include "htslib/vcf.h"
#include "pythread.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#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
typedef struct {PyObject **p; 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_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#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 char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#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 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (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;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    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 PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "pysam/cbcf.pyx",
  "pysam/cbcf.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_5pysam_4cbcf_VariantHeader;
struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord;
struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords;
struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs;
struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples;
struct __pyx_obj_5pysam_4cbcf_VariantContig;
struct __pyx_obj_5pysam_4cbcf_VariantMetadata;
struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata;
struct __pyx_obj_5pysam_4cbcf_VariantRecord;
struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter;
struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat;
struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo;
struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples;
struct __pyx_obj_5pysam_4cbcf_VariantRecordSample;
struct __pyx_obj_5pysam_4cbcf_BaseIndex;
struct __pyx_obj_5pysam_4cbcf_BCFIndex;
struct __pyx_obj_5pysam_4cbcf_TabixIndex;
struct __pyx_obj_5pysam_4cbcf_BaseIterator;
struct __pyx_obj_5pysam_4cbcf_BCFIterator;
struct __pyx_obj_5pysam_4cbcf_TabixIterator;
struct __pyx_obj_5pysam_4cbcf_VariantFile;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues;
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems;
struct __pyx_opt_args_5pysam_4cbcf_char_array_to_tuple;
struct __pyx_opt_args_5pysam_4cbcf_bcf_array_to_object;

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

/* "pysam/cbcf.pyx":296
 * 
 * 
 * cdef bcf_array_to_object(void *data, int type, int n, int scalar=0):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
 */
struct __pyx_opt_args_5pysam_4cbcf_bcf_array_to_object {
  int __pyx_n;
  int scalar;
};

/* "pysam/cbcf.pxd":47
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *ptr
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeader {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_4cbcf_VariantHeader *__pyx_vtab;
  bcf_hdr_t *ptr;
};


/* "pysam/cbcf.pxd":53
 * 
 * 
 * cdef class VariantHeaderRecord(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef bcf_hrec_t *ptr
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  bcf_hrec_t *ptr;
};


/* "pysam/cbcf.pxd":58
 * 
 * 
 * cdef class VariantHeaderRecords(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
};


/* "pysam/cbcf.pxd":62
 * 
 * 
 * cdef class VariantHeaderContigs(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
};


/* "pysam/cbcf.pxd":66
 * 
 * 
 * cdef class VariantHeaderSamples(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
};


/* "pysam/cbcf.pxd":70
 * 
 * 
 * cdef class VariantContig(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef int id
 */
struct __pyx_obj_5pysam_4cbcf_VariantContig {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  int id;
};


/* "pysam/cbcf.pxd":75
 * 
 * 
 * cdef class VariantMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef int type
 */
struct __pyx_obj_5pysam_4cbcf_VariantMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  int type;
  int id;
};


/* "pysam/cbcf.pxd":81
 * 
 * 
 * cdef class VariantHeaderMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef int32_t type
 */
struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  int32_t type;
};


/* "pysam/cbcf.pxd":86
 * 
 * 
 * cdef class VariantRecord(object):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef bcf1_t *ptr
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  bcf1_t *ptr;
};


/* "pysam/cbcf.pxd":91
 * 
 * 
 * cdef class VariantRecordFilter(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *record;
};


/* "pysam/cbcf.pxd":95
 * 
 * 
 * cdef class VariantRecordFormat(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *record;
};


/* "pysam/cbcf.pxd":99
 * 
 * 
 * cdef class VariantRecordInfo(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *record;
};


/* "pysam/cbcf.pxd":103
 * 
 * 
 * cdef class VariantRecordSamples(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *record;
};


/* "pysam/cbcf.pxd":107
 * 
 * 
 * cdef class VariantRecordSample(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 *     cdef readonly int32_t index
 */
struct __pyx_obj_5pysam_4cbcf_VariantRecordSample {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *record;
  int32_t index;
};


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


/* "pysam/cbcf.pxd":117
 * 
 * 
 * cdef class BCFIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef VariantHeader header
 *     cdef hts_idx_t *ptr
 */
struct __pyx_obj_5pysam_4cbcf_BCFIndex {
  struct __pyx_obj_5pysam_4cbcf_BaseIndex __pyx_base;
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  hts_idx_t *ptr;
};


/* "pysam/cbcf.pxd":122
 * 
 * 
 * cdef class TabixIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef tbx_t *ptr
 * 
 */
struct __pyx_obj_5pysam_4cbcf_TabixIndex {
  struct __pyx_obj_5pysam_4cbcf_BaseIndex __pyx_base;
  tbx_t *ptr;
};


/* "pysam/cbcf.pxd":126
 * 
 * 
 * cdef class BaseIterator(object):             # <<<<<<<<<<<<<<
 *     cdef VariantFile bcf
 *     cdef hts_itr_t  *iter
 */
struct __pyx_obj_5pysam_4cbcf_BaseIterator {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantFile *bcf;
  hts_itr_t *iter;
};


/* "pysam/cbcf.pxd":131
 * 
 * 
 * cdef class BCFIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef BCFIndex index
 * 
 */
struct __pyx_obj_5pysam_4cbcf_BCFIterator {
  struct __pyx_obj_5pysam_4cbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *index;
};


/* "pysam/cbcf.pxd":135
 * 
 * 
 * cdef class TabixIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef TabixIndex index
 *     cdef kstring_t line_buffer
 */
struct __pyx_obj_5pysam_4cbcf_TabixIterator {
  struct __pyx_obj_5pysam_4cbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_4cbcf_TabixIndex *index;
  kstring_t line_buffer;
};


/* "pysam/cbcf.pxd":140
 * 
 * 
 * cdef class VariantFile(object):             # <<<<<<<<<<<<<<
 *     cdef htsFile *htsfile                  # pointer to htsFile structure
 *     cdef int64_t  start_offset             # BGZF offset of first record
 */
struct __pyx_obj_5pysam_4cbcf_VariantFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_4cbcf_VariantFile *__pyx_vtab;
  htsFile *htsfile;
  int64_t start_offset;
  PyObject *filename;
  PyObject *mode;
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *header;
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *index;
  int drop_samples;
  int is_bcf;
  int is_stream;
  int is_remote;
  int is_reading;
};


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


/* "pysam/cbcf.pyx":290
 *         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_4cbcf___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *__pyx_outer_scope;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "pysam/cbcf.pyx":411
 *     property attrs:
 *         """sequence of additional header attributes"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ {
  PyObject_HEAD
  bcf_hrec_t *__pyx_v_r;
};


/* "pysam/cbcf.pyx":414
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *__pyx_outer_scope;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "pysam/cbcf.pyx":417
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self;
};


/* "pysam/cbcf.pyx":422
 *             return '##{}={}'.format(self.key, self.value)
 *         else:
 *             attrs = ','.join('{}={}'.format(k, v) for k,v in self.attrs if k != 'IDX')             # <<<<<<<<<<<<<<
 *             return '##{}=<{}>'.format(self.type, attrs)
 * 
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *__pyx_outer_scope;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/cbcf.pyx":455
 *         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_4cbcf___pyx_scope_struct_6___iter__ {
  PyObject_HEAD
  int32_t __pyx_v_i;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self;
  int __pyx_t_0;
  int32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":575
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_i;
  bcf_idpair_t *__pyx_v_idpair;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
};


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


/* "pysam/cbcf.pyx":609
 *             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_4cbcf___pyx_scope_struct_9_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/cbcf.pyx":719
 *         return makeVariantContig(self.header, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ {
  PyObject_HEAD
  vdict_t *__pyx_v_d;
  bcf_hdr_t *__pyx_v_h;
  uint32_t __pyx_v_i;
  uint32_t __pyx_v_n;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
};


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


/* "pysam/cbcf.pyx":753
 *             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_4cbcf___pyx_scope_struct_12_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/cbcf.pyx":805
 *         return h.samples[i]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":980
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
};


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


/* "pysam/cbcf.pyx":1009
 *             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_4cbcf___pyx_scope_struct_16_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/cbcf.pyx":1070
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
};


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


/* "pysam/cbcf.pyx":1100
 *             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_4cbcf___pyx_scope_struct_19_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/cbcf.pyx":1153
 *         return bcf_info_value(info)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "pysam/cbcf.pyx":1179
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues {
  PyObject_HEAD
  int __pyx_v_i;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "pysam/cbcf.pyx":1189
 *             yield bcf_info_value(info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_i;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self;
  PyObject *__pyx_v_value;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "pysam/cbcf.pyx":1259
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":1295
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":1304
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":1438
 *     property alleles:
 *         """tuple of reference allele followed by alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self;
};


/* "pysam/cbcf.pyx":1443
 *             if not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property alts:
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *__pyx_outer_scope;
  uint32_t __pyx_v_i;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
};


/* "pysam/cbcf.pyx":1447
 *     property alts:
 *         """tuple of alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self;
};


/* "pysam/cbcf.pyx":1452
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(1,self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property filter:
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *__pyx_outer_scope;
  long __pyx_v_i;
  uint32_t __pyx_t_0;
  long __pyx_t_1;
};


/* "pysam/cbcf.pyx":1666
 *             return None
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */
struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_i;
  int __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
};


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


/* "pysam/cbcf.pyx":1696
 *             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_4cbcf___pyx_scope_struct_32_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


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


/* "pysam/cbcf.pyx":1780
 *             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_4cbcf___pyx_scope_struct_34_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};



/* "pysam/cbcf.pyx":836
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     """header information for a :class:`VariantFile` object"""
 * 
 */

struct __pyx_vtabstruct_5pysam_4cbcf_VariantHeader {
  PyObject *(*_subset_samples)(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, PyObject *);
};
static struct __pyx_vtabstruct_5pysam_4cbcf_VariantHeader *__pyx_vtabptr_5pysam_4cbcf_VariantHeader;


/* "pysam/cbcf.pyx":2068
 * 
 * 
 * cdef class VariantFile(object):             # <<<<<<<<<<<<<<
 *     """*(filename, mode=None, header=None, drop_samples=False)*
 * 
 */

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

#if CYTHON_COMPILING_IN_CPYTHON
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);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

#ifndef CYTHON_PROFILE
  #define CYTHON_PROFILE 1
#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 CYTHON_PROFILE_REUSE_FRAME
    #define CYTHON_FRAME_MODIFIER static
    #define CYTHON_FRAME_DEL
  #else
    #define CYTHON_FRAME_MODIFIER
    #define CYTHON_FRAME_DEL Py_CLEAR(__pyx_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_TraceCall(funcname, srcfile, firstlineno)                            \
  if (unlikely(PyThreadState_GET()->use_tracing &&                                   \
          (PyThreadState_GET()->c_profilefunc || (CYTHON_TRACE && PyThreadState_GET()->c_tracefunc)))) {      \
      __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, funcname, srcfile, firstlineno);  \
  }
  #define __Pyx_TraceException()                                                           \
  if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing &&                   \
          (PyThreadState_GET()->c_profilefunc || (CYTHON_TRACE && PyThreadState_GET()->c_tracefunc))) {  \
      PyThreadState* tstate = PyThreadState_GET();                                         \
      tstate->use_tracing = 0;                                                             \
      PyObject *exc_info = __Pyx_GetExceptionTuple();                                      \
      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);                                                             \
      }                                                                                    \
      tstate->use_tracing = 1;                                                             \
  }
  #define __Pyx_TraceReturn(result)                                                  \
  if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing) {             \
      PyThreadState* tstate = PyThreadState_GET();                                   \
      tstate->use_tracing = 0;                                                        \
      if (CYTHON_TRACE && tstate->c_tracefunc)                                       \
          tstate->c_tracefunc(                                                       \
              tstate->c_traceobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result);  \
      if (tstate->c_profilefunc)                                                     \
          tstate->c_profilefunc(                                                     \
              tstate->c_profileobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result);  \
      CYTHON_FRAME_DEL;                                                              \
      tstate->use_tracing = 1;                                                       \
  }
  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, const char *funcname, const char *srcfile, int firstlineno);
#else
  #define __Pyx_TraceDeclarations
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno)
  #define __Pyx_TraceException()
  #define __Pyx_TraceReturn(result)
#endif
#if CYTHON_TRACE
  #define __Pyx_TraceLine(lineno)                                                          \
  if (unlikely(__Pyx_use_tracing) && unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_tracefunc)) {    \
      PyThreadState* tstate = PyThreadState_GET();                                         \
      __pyx_frame->f_lineno = lineno;                                                     \
      tstate->use_tracing = 0;                                                             \
      tstate->c_tracefunc(tstate->c_traceobj, __pyx_frame, PyTrace_LINE, NULL);           \
      tstate->use_tracing = 1;                                                             \
  }
#else
  #define __Pyx_TraceLine(lineno)
#endif

#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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

#include <string.h>

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);

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

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

#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 CYTHON_INLINE 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);

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void);

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

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

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

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

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

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

#if CYTHON_COMPILING_IN_CPYTHON
#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) {
    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);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

static int __Pyx_SetVtable(PyObject *dict, void *vtable);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __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);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int8_t(int8_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int16_t(int16_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);

static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

#define __Pyx_Generator_USED
#include <structmember.h>
#include <frameobject.h>
typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_generator_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    int resume_label;
    char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure, PyObject *name, PyObject *qualname);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

static int __Pyx_check_binary_version(void);

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name);

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static PyObject *__pyx_f_5pysam_4cbcf_13VariantHeader__subset_samples(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_include_samples); /* proto*/
static int __pyx_f_5pysam_4cbcf_11VariantFile_write(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_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.chtslib' */

/* Module declarations from 'cython' */

/* 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.object' */

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

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

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

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

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

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

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

/* Module declarations from 'pysam.cbcf' */
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeader = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeaderRecord = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeaderRecords = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeaderContigs = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeaderSamples = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantContig = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantMetadata = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecord = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecordFilter = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecordFormat = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecordInfo = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecordSamples = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantRecordSample = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_BaseIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_BCFIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_TabixIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_BaseIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_BCFIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_TabixIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf_VariantFile = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_2___get__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_4___str__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_5_genexpr = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_6___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_8_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_9_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_10___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_11_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_12_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_13___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_14___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_15_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_16_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_17___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_18_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_19_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_20___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_21_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_22_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_23___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_24_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_25_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_26___get__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_27_genexpr = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_28___get__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_29_genexpr = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_30___iter__ = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_31_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_32_iteritems = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_33_itervalues = 0;
static PyTypeObject *__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_34_iteritems = 0;
static int __pyx_v_5pysam_4cbcf_MAX_POS;
static PyObject *__pyx_v_5pysam_4cbcf_VALUE_TYPES = 0;
static PyObject *__pyx_v_5pysam_4cbcf_METADATA_TYPES = 0;
static PyObject *__pyx_v_5pysam_4cbcf_METADATA_LENGTHS = 0;
static PyObject *__pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES = 0;
static PyObject *__pyx_v_5pysam_4cbcf_FORMATS = 0;
static PyObject *__pyx_v_5pysam_4cbcf_COMPRESSION = 0;
static PyObject *__pyx_v_5pysam_4cbcf_FILENAME_ENCODING = 0;
static PyObject *__pyx_f_5pysam_4cbcf_encode_filename(PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_force_str(PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_force_bytes(PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_charptr_to_str(char const *); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_char_array_to_tuple(char const **, int, struct __pyx_opt_args_5pysam_4cbcf_char_array_to_tuple *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_bcf_array_to_object(void *, int, int, struct __pyx_opt_args_5pysam_4cbcf_bcf_array_to_object *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5pysam_4cbcf_bcf_info_value(bcf_info_t const *); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_4cbcf_is_gt_fmt(bcf_hdr_t *, bcf_fmt_t *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_f_5pysam_4cbcf_makeVariantHeaderRecord(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, bcf_hrec_t *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_f_5pysam_4cbcf_makeVariantHeaderRecords(struct __pyx_obj_5pysam_4cbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_f_5pysam_4cbcf_makeVariantMetadata(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, int, int); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_f_5pysam_4cbcf_makeVariantHeaderMetadata(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, int32_t); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_f_5pysam_4cbcf_makeVariantContig(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, int); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_f_5pysam_4cbcf_makeVariantHeaderContigs(struct __pyx_obj_5pysam_4cbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_f_5pysam_4cbcf_makeVariantHeaderSamples(struct __pyx_obj_5pysam_4cbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_f_5pysam_4cbcf_makeVariantHeader(bcf_hdr_t *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_f_5pysam_4cbcf_makeVariantRecordFilter(struct __pyx_obj_5pysam_4cbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_f_5pysam_4cbcf_makeVariantRecordFormat(struct __pyx_obj_5pysam_4cbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_f_5pysam_4cbcf_makeVariantRecordInfo(struct __pyx_obj_5pysam_4cbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_f_5pysam_4cbcf_makeVariantRecordSamples(struct __pyx_obj_5pysam_4cbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_f_5pysam_4cbcf_makeVariantRecord(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, bcf1_t *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_f_5pysam_4cbcf_makeVariantRecordSample(struct __pyx_obj_5pysam_4cbcf_VariantRecord *, int32_t); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_f_5pysam_4cbcf_makeBCFIndex(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, hts_idx_t *); /*proto*/
static struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_f_5pysam_4cbcf_makeTabixIndex(tbx_t *); /*proto*/
static void __pyx_f_5pysam_4cbcf__stop_BCFIterator(struct __pyx_obj_5pysam_4cbcf_BCFIterator *, bcf1_t *); /*proto*/
#define __Pyx_MODULE_NAME "pysam.cbcf"
int __pyx_module_is_main_pysam__cbcf = 0;

/* Implementation of 'pysam.cbcf' */
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_OSError;
static PyObject *__pyx_pf_5pysam_4cbcf_19char_array_to_tuple_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_4type___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_3key___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5value___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_7__str___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord___str__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_6number___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_4type___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_9get(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_21keys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_23items(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_25values(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_6length___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_9get(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_21keys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_23items(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_25values(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_9__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_5pysam_4cbcf_13VariantHeader___cinit__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_mode); /* proto */
static int __pyx_pf_5pysam_4cbcf_13VariantHeader_2__init__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_mode); /* proto */
static void __pyx_pf_5pysam_4cbcf_13VariantHeader_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_13VariantHeader_6__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_8copy(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7version___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7records___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7contigs___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7filters___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_4info___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7formats___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_10__str__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordFilter___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordFormat___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_17VariantRecordInfo___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantRecordSamples___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_4cbcf_13VariantRecord___dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3rid___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_5chrom___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6contig___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3pos___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_5start___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4stop___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4rlen___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4qual___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3ref___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles_7__get___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4alts_7__get___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4alts___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6filter___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4info___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6format___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_2__str__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_14allele_indices___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_7alleles___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordSample___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordSample_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_19VariantRecordSample_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_5index___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_9BaseIndex___init__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_4cbcf_9BaseIndex_2__len__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_9BaseIndex_4__bool__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_6__getitem__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_8__iter__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_10get(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_4cbcf_9BaseIndex_12__contains__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_14iterkeys(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_16itervalues(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_19iteritems(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_22keys(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_24items(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_26values(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_8BCFIndex___init__(struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_4cbcf_8BCFIndex_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_8BCFIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen); /* proto */
static int __pyx_pf_5pysam_4cbcf_10TabixIndex___init__(struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_4cbcf_10TabixIndex_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_10TabixIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen); /* proto */
static int __pyx_pf_5pysam_4cbcf_11BCFIterator___init__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen); /* proto */
static void __pyx_pf_5pysam_4cbcf_11BCFIterator_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11BCFIterator_4__iter__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11BCFIterator_6__next__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_13TabixIterator___cinit__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_5pysam_4cbcf_13TabixIterator_2__init__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen); /* proto */
static void __pyx_pf_5pysam_4cbcf_13TabixIterator_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13TabixIterator_6__iter__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_13TabixIterator_8__next__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_4cbcf_11VariantFile___cinit__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_5pysam_4cbcf_11VariantFile_2__init__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_5pysam_4cbcf_11VariantFile_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6__enter__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8__exit__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8category___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6format___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_7version___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_11compression___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_11description___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_10close(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_7is_open___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_12__iter__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_14__next__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_16copy(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_18open(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, PyObject *__pyx_v_drop_samples); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_20reset(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_22seek(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, uint64_t __pyx_v_offset); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_24tell(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_26fetch(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_28write(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_30subset_samples(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_include_samples); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8filename___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_4mode___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_5index___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_12drop_samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6is_bcf___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_9is_stream___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_9is_remote___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_10is_reading___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderRecords(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderContigs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderSamples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantContig(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantMetadata(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderMetadata(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordFilter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordFormat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordSamples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordSample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_BaseIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_BCFIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_TabixIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_BaseIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_BCFIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_2___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_4___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_6___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_8_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_9_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_10___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_11_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_12_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_13___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_14___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_15_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_16_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_17___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_18_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_19_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_20___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_21_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_22_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_23___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_24_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_25_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_26___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_27_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_28___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_29_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_30___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_31_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_32_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_33_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_34_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_A[] = "A";
static char __pyx_k_G[] = "G";
static char __pyx_k_R[] = "R";
static char __pyx_k_r[] = "r";
static char __pyx_k_w[] = "w";
static char __pyx_k_GT[] = "GT";
static char __pyx_k__7[] = "{}={}";
static char __pyx_k__8[] = "##{}={}";
static char __pyx_k__9[] = ",";
static char __pyx_k_os[] = "os";
static char __pyx_k_rU[] = "rU";
static char __pyx_k_rb[] = "rb";
static char __pyx_k_rw[] = "rw";
static char __pyx_k_wb[] = "wb";
static char __pyx_k_wh[] = "wh";
static char __pyx_k_BAI[] = "BAI";
static char __pyx_k_BAM[] = "BAM";
static char __pyx_k_BCF[] = "BCF";
static char __pyx_k_BED[] = "BED";
static char __pyx_k_CSI[] = "CSI";
static char __pyx_k_GZI[] = "GZI";
static char __pyx_k_IDX[] = "IDX";
static char __pyx_k_SAM[] = "SAM";
static char __pyx_k_TBI[] = "TBI";
static char __pyx_k_VCF[] = "VCF";
static char __pyx_k__10[] = "##{}=<{}>";
static char __pyx_k__14[] = ".";
static char __pyx_k__82[] = "-";
static char __pyx_k_all[] = "__all__";
static char __pyx_k_bcf[] = "bcf";
static char __pyx_k_ftp[] = "ftp:";
static char __pyx_k_get[] = "get";
static char __pyx_k_key[] = "key";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_tbi[] = ".tbi";
static char __pyx_k_wb0[] = "wb0";
static char __pyx_k_wbu[] = "wbu";
static char __pyx_k_BGZF[] = "BGZF";
static char __pyx_k_CRAI[] = "CRAI";
static char __pyx_k_CRAM[] = "CRAM";
static char __pyx_k_Flag[] = "Flag";
static char __pyx_k_GZIP[] = "GZIP";
static char __pyx_k_INFO[] = "INFO";
static char __pyx_k_NONE[] = "NONE";
static char __pyx_k_PASS[] = "PASS";
static char __pyx_k_args[] = "args";
static char __pyx_k_copy[] = "copy";
static char __pyx_k_hash[] = "__hash__";
static char __pyx_k_http[] = "http:";
static char __pyx_k_init[] = "__init__";
static char __pyx_k_iter[] = "__iter__";
static char __pyx_k_join[] = "join";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_mode[] = "mode";
static char __pyx_k_open[] = "open";
static char __pyx_k_path[] = "path";
static char __pyx_k_seek[] = "seek";
static char __pyx_k_send[] = "send";
static char __pyx_k_stop[] = "stop";
static char __pyx_k_tell[] = "tell";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_type[] = "type";
static char __pyx_k_FIXED[] = "FIXED";
static char __pyx_k_Float[] = "Float";
static char __pyx_k_INDEX[] = "INDEX";
static char __pyx_k_ascii[] = "ascii";
static char __pyx_k_attrs[] = "attrs";
static char __pyx_k_close[] = "close";
static char __pyx_k_fetch[] = "fetch";
static char __pyx_k_range[] = "range";
static char __pyx_k_remap[] = "remap";
static char __pyx_k_start[] = "start";
static char __pyx_k_throw[] = "throw";
static char __pyx_k_value[] = "value";
static char __pyx_k_write[] = "write";
static char __pyx_k_CONTIG[] = "CONTIG";
static char __pyx_k_CUSTOM[] = "CUSTOM";
static char __pyx_k_FILTER[] = "FILTER";
static char __pyx_k_FORMAT[] = "FORMAT";
static char __pyx_k_String[] = "String";
static char __pyx_k_append[] = "append";
static char __pyx_k_contig[] = "contig";
static char __pyx_k_decode[] = "decode";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_exists[] = "exists";
static char __pyx_k_format[] = "format";
static char __pyx_k_header[] = "header";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_region[] = "region";
static char __pyx_k_reopen[] = "reopen";
static char __pyx_k_GENERIC[] = "GENERIC";
static char __pyx_k_IOError[] = "IOError";
static char __pyx_k_Integer[] = "Integer";
static char __pyx_k_OSError[] = "OSError";
static char __pyx_k_REGIONS[] = "REGIONS";
static char __pyx_k_UNKNOWN[] = "UNKNOWN";
static char __pyx_k_alleles[] = "alleles";
static char __pyx_k_default[] = "default";
static char __pyx_k_genexpr[] = "genexpr";
static char __pyx_k_is_open[] = "is_open";
static char __pyx_k_samples[] = "samples";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_VARIABLE[] = "VARIABLE";
static char __pyx_k_VARIANTS[] = "VARIANTS";
static char __pyx_k_exc_type[] = "exc_type";
static char __pyx_k_filename[] = "filename";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_enumerate[] = "enumerate";
static char __pyx_k_exc_value[] = "exc_value";
static char __pyx_k_iteritems[] = "iteritems";
static char __pyx_k_traceback[] = "traceback";
static char __pyx_k_ALIGNMENTS[] = "ALIGNMENTS";
static char __pyx_k_IS_PYTHON3[] = "IS_PYTHON3";
static char __pyx_k_IndexError[] = "IndexError";
static char __pyx_k_STRUCTURED[] = "STRUCTURED";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_itervalues[] = "itervalues";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_startswith[] = "startswith";
static char __pyx_k_TEXT_FORMAT[] = "TEXT_FORMAT";
static char __pyx_k_VCF_version[] = "VCF version";
static char __pyx_k_VariantFile[] = "VariantFile";
static char __pyx_k_contig_name[] = "contig name";
static char __pyx_k_sample_name[] = "sample name";
static char __pyx_k_drop_samples[] = "drop_samples";
static char __pyx_k_write_failed[] = "write failed";
static char __pyx_k_BINARY_FORMAT[] = "BINARY_FORMAT";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_VariantHeader[] = "VariantHeader";
static char __pyx_k_metadata_name[] = "metadata name";
static char __pyx_k_Invalid_filter[] = "Invalid filter";
static char __pyx_k_file_not_found[] = "file `{}` not found";
static char __pyx_k_invalid_contig[] = "invalid contig";
static char __pyx_k_invalid_filter[] = "invalid filter";
static char __pyx_k_truncated_file[] = "truncated file";
static char __pyx_k_unknown_format[] = "unknown format";
static char __pyx_k_reference_allele[] = "reference allele";
static char __pyx_k_invalid_contig_id[] = "invalid contig id";
static char __pyx_k_vcf_format_failed[] = "vcf_format failed";
static char __pyx_k_Unknown_INFO_field[] = "Unknown INFO field: {}";
static char __pyx_k_bcf_index_required[] = "bcf index required";
static char __pyx_k_error_in_vcf_parse[] = "error in vcf_parse";
static char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
static char __pyx_k_BaseIndex_iteritems[] = "BaseIndex.iteritems";
static char __pyx_k_Variant_read_failed[] = "Variant read failed";
static char __pyx_k_invalid_metadata_id[] = "invalid metadata id";
static char __pyx_k_invalid_sample_name[] = "invalid sample name";
static char __pyx_k_metadata_value_type[] = "metadata value type";
static char __pyx_k_BaseIndex_itervalues[] = "BaseIndex.itervalues";
static char __pyx_k_Invalid_index_object[] = "Invalid index object";
static char __pyx_k_invalid_contig_index[] = "invalid contig index";
static char __pyx_k_invalid_filter_index[] = "invalid filter index";
static char __pyx_k_invalid_format_index[] = "invalid format index";
static char __pyx_k_invalid_sample_index[] = "invalid sample index";
static char __pyx_k_str___locals_genexpr[] = "__str__.<locals>.genexpr";
static char __pyx_k_tabix_index_required[] = "tabix index required";
static char __pyx_k_tuple_of_alt_alleles[] = "tuple of alt alleles";
static char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
static char __pyx_k_invalid_VariantHeader[] = "invalid VariantHeader";
static char __pyx_k_invalid_VariantRecord[] = "invalid VariantRecord";
static char __pyx_k_invalid_metadata_type[] = "invalid metadata type";
static char __pyx_k_Cannot_re_open_htsfile[] = "Cannot re-open htsfile";
static char __pyx_k_chromosome_contig_name[] = "chromosome/contig name";
static char __pyx_k_error_reading_BCF_file[] = "error reading BCF file";
static char __pyx_k_fetch_requires_an_index[] = "fetch requires an index";
static char __pyx_k_VariantRecordInfo___iter[] = "VariantRecordInfo.__iter__";
static char __pyx_k_could_not_open_file_mode[] = "could not open file `{}` (mode='{}')";
static char __pyx_k_invalid_format_requested[] = "invalid format requested";
static char __pyx_k_contig_internal_id_number[] = "contig internal id number";
static char __pyx_k_invalid_file_opening_mode[] = "invalid file opening mode `{}`";
static char __pyx_k_VariantRecordFilter___iter[] = "VariantRecordFilter.__iter__";
static char __pyx_k_VariantRecordFormat___iter[] = "VariantRecordFormat.__iter__";
static char __pyx_k_VariantRecordSample___iter[] = "VariantRecordSample.__iter__";
static char __pyx_k_error_in_bcf_subset_format[] = "error in bcf_subset_format";
static char __pyx_k_unsupported_info_type_code[] = "unsupported info type code";
static char __pyx_k_VariantHeaderContigs___iter[] = "VariantHeaderContigs.__iter__";
static char __pyx_k_VariantHeaderRecords___iter[] = "VariantHeaderRecords.__iter__";
static char __pyx_k_VariantHeaderSamples___iter[] = "VariantHeaderSamples.__iter__";
static char __pyx_k_VariantRecordInfo_iteritems[] = "VariantRecordInfo.iteritems";
static char __pyx_k_VariantRecordSamples___iter[] = "VariantRecordSamples.__iter__";
static char __pyx_k_cannot_create_VariantHeader[] = "cannot create VariantHeader";
static char __pyx_k_cannot_create_VariantRecord[] = "cannot create VariantRecord";
static char __pyx_k_invalid_header_record_index[] = "invalid header record index";
static char __pyx_k_missing_d_requested_samples[] = "missing {:d} requested samples";
static char __pyx_k_I_O_operation_on_closed_file[] = "I/O operation on closed file";
static char __pyx_k_VariantHeaderMetadata___iter[] = "VariantHeaderMetadata.__iter__";
static char __pyx_k_VariantRecordInfo_itervalues[] = "VariantRecordInfo.itervalues";
static char __pyx_k_internal_reference_id_number[] = "internal reference id number";
static char __pyx_k_Error_unpacking_VariantRecord[] = "Error unpacking VariantRecord";
static char __pyx_k_VariantRecordFilter_iteritems[] = "VariantRecordFilter.iteritems";
static char __pyx_k_VariantRecordFormat_iteritems[] = "VariantRecordFormat.iteritems";
static char __pyx_k_VariantRecordSample_iteritems[] = "VariantRecordSample.iteritems";
static char __pyx_k_invalid_header_mode_specified[] = "invalid header mode specified '{}'";
static char __pyx_k_seek_not_available_in_streams[] = "seek not available in streams";
static char __pyx_k_tell_not_available_in_streams[] = "tell not available in streams";
static char __pyx_k_VariantHeaderContigs_iteritems[] = "VariantHeaderContigs.iteritems";
static char __pyx_k_VariantRecordFilter_itervalues[] = "VariantRecordFilter.itervalues";
static char __pyx_k_VariantRecordFormat_itervalues[] = "VariantRecordFormat.itervalues";
static char __pyx_k_VariantRecordSample_itervalues[] = "VariantRecordSample.itervalues";
static char __pyx_k_VariantRecordSamples_iteritems[] = "VariantRecordSamples.iteritems";
static char __pyx_k_bcf_hdr_set_samples_failed_ret[] = "bcf_hdr_set_samples failed: ret = {}";
static char __pyx_k_error_reading_indexed_VCF_file[] = "error reading indexed VCF file";
static char __pyx_k_VariantHeaderContigs_itervalues[] = "VariantHeaderContigs.itervalues";
static char __pyx_k_VariantHeaderMetadata_iteritems[] = "VariantHeaderMetadata.iteritems";
static char __pyx_k_VariantRecordSamples_itervalues[] = "VariantRecordSamples.itervalues";
static char __pyx_k_cannot_iterate_over_Variantfile[] = "cannot iterate over Variantfile opened for writing";
static char __pyx_k_class_VariantHeaderRecord_assoc[] = ":class:`VariantHeaderRecord` associated with this :class:`VariantContig` object";
static char __pyx_k_file_does_not_have_valid_header[] = "file `{}` does not have valid header (mode='{}') - is it BCF format?";
static char __pyx_k_metadata_number_i_e_cardinality[] = "metadata number (i.e. cardinality)";
static char __pyx_k_Argument_must_be_string_bytes_or[] = "Argument must be string, bytes or unicode.";
static char __pyx_k_Argument_must_be_string_or_unico[] = "Argument must be string or unicode.";
static char __pyx_k_Cannot_retrieve_reference_sequen[] = "Cannot retrieve reference sequence names";
static char __pyx_k_File_compression_One_of_NONE_GZI[] = "File compression.  One of NONE, GZIP, BGZF, CUSTOM.";
static char __pyx_k_File_format_One_of_UNKNOWN_BINAR[] = "File format.\n           One of UNKNOWN, BINARY_FORMAT, TEXT_FORMAT, SAM, BAM, BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.\n        ";
static char __pyx_k_General_file_format_category_One[] = "General file format category.  One of UNKNOWN, ALIGNMENTS, VARIANTS, INDEX, REGIONS";
static char __pyx_k_Tuple_of_file_format_version_num[] = "Tuple of file format version numbers (major, minor)";
static char __pyx_k_Vaguely_human_readable_descripti[] = "Vaguely human readable description of the file format";
static char __pyx_k_VariantHeaderMetadata_itervalues[] = "VariantHeaderMetadata.itervalues";
static char __pyx_k_VariantHeaderRecord___get___loca[] = "VariantHeaderRecord.__get__.<locals>.genexpr";
static char __pyx_k_VariantRecord___get___locals_gen[] = "VariantRecord.__get__.<locals>.genexpr";
static char __pyx_k_a_VariantHeader_must_be_specifie[] = "a VariantHeader must be specified";
static char __pyx_k_allele_indices_for_called_genoty[] = "allele indices for called genotype, if present.  Otherwise None";
static char __pyx_k_alleles_for_called_genotype_if_p[] = "alleles for called genotype, if present.  Otherwise None";
static char __pyx_k_cannot_create_VariantRecordSampl[] = "cannot create VariantRecordSample";
static char __pyx_k_cannot_fetch_from_Variantfile_op[] = "cannot fetch from Variantfile opened for writing";
static char __pyx_k_cannot_subset_samples_after_fetc[] = "cannot subset samples after fetching records";
static char __pyx_k_cannot_subset_samples_from_Varia[] = "cannot subset samples from Variantfile opened for writing";
static char __pyx_k_char_array_to_tuple_locals_genex[] = "char_array_to_tuple.<locals>.genexpr";
static char __pyx_k_contig_information_class_Variant[] = "contig information (:class:`VariantHeaderContigs`)";
static char __pyx_k_contig_length_or_None_if_not_ava[] = "contig length or None if not available";
static char __pyx_k_could_not_open_file_mode_is_it_V[] = "could not open file `{}` (mode='{}') - is it VCF/BCF format?";
static char __pyx_k_filter_information_see_class_Var[] = "filter information (see :class:`VariantRecordFilter`)";
static char __pyx_k_filter_metadata_class_VariantHea[] = "filter metadata (:class:`VariantHeaderMetadata`)";
static char __pyx_k_format_metadata_class_VariantHea[] = "format metadata (:class:`VariantHeaderMetadata`)";
static char __pyx_k_header_key_the_part_before_in_FI[] = "header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)";
static char __pyx_k_header_records_class_VariantHead[] = "header records (:class:`VariantHeaderRecords`)";
static char __pyx_k_header_type_FILTER_INFO_FORMAT_C[] = "header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC";
static char __pyx_k_header_value_Set_only_for_generi[] = "header value.  Set only for generic lines, None for FILTER/INFO, etc.";
static char __pyx_k_info_data_see_class_VariantRecor[] = "info data (see :class:`VariantRecordInfo`)";
static char __pyx_k_info_metadata_class_VariantHeade[] = "info metadata (:class:`VariantHeaderMetadata`)";
static char __pyx_k_metadata_internal_header_id_numb[] = "metadata internal header id number";
static char __pyx_k_metadata_not_available_on_closed[] = "metadata not available on closed file";
static char __pyx_k_phred_scaled_quality_score_or_No[] = "phred scaled quality score or None if not available";
static char __pyx_k_record_identifier_or_None_if_not[] = "record identifier or None if not available";
static char __pyx_k_record_length_on_chrom_contig_re[] = "record length on chrom/contig (rec.stop - rec.start)";
static char __pyx_k_record_start_position_on_chrom_c[] = "record start position on chrom/contig (1-based inclusive)";
static char __pyx_k_record_stop_position_on_chrom_co[] = "record stop position on chrom/contig (0-based exclusive)";
static char __pyx_k_sample_data_see_class_VariantRec[] = "sample data (see :class:`VariantRecordSamples`)";
static char __pyx_k_sample_format_metadata_see_class[] = "sample format metadata (see :class:`VariantRecordFormat`)";
static char __pyx_k_samples_class_VariantHeaderSampl[] = "samples (:class:`VariantHeaderSamples`)";
static char __pyx_k_sequence_of_additional_header_at[] = "sequence of additional header attributes";
static char __pyx_k_tuple_of_reference_allele_follow[] = "tuple of reference allele followed by alt alleles";
static char __pyx_k_class_VariantHeaderRecord_assoc_2[] = ":class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object";
static char __pyx_k_record_start_position_on_chrom_c_2[] = "record start position on chrom/contig (0-based inclusive)";
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_ALIGNMENTS;
static PyObject *__pyx_kp_s_Argument_must_be_string_bytes_or;
static PyObject *__pyx_kp_s_Argument_must_be_string_or_unico;
static PyObject *__pyx_n_s_BAI;
static PyObject *__pyx_n_s_BAM;
static PyObject *__pyx_n_s_BCF;
static PyObject *__pyx_n_s_BED;
static PyObject *__pyx_n_s_BGZF;
static PyObject *__pyx_n_s_BINARY_FORMAT;
static PyObject *__pyx_n_s_BaseIndex_iteritems;
static PyObject *__pyx_n_s_BaseIndex_itervalues;
static PyObject *__pyx_n_s_CONTIG;
static PyObject *__pyx_n_s_CRAI;
static PyObject *__pyx_n_s_CRAM;
static PyObject *__pyx_n_s_CSI;
static PyObject *__pyx_n_s_CUSTOM;
static PyObject *__pyx_kp_s_Cannot_re_open_htsfile;
static PyObject *__pyx_kp_s_Cannot_retrieve_reference_sequen;
static PyObject *__pyx_kp_s_Error_unpacking_VariantRecord;
static PyObject *__pyx_n_s_FILTER;
static PyObject *__pyx_n_s_FIXED;
static PyObject *__pyx_n_s_FORMAT;
static PyObject *__pyx_n_s_Flag;
static PyObject *__pyx_n_s_Float;
static PyObject *__pyx_n_s_G;
static PyObject *__pyx_n_s_GENERIC;
static PyObject *__pyx_n_s_GZI;
static PyObject *__pyx_n_s_GZIP;
static PyObject *__pyx_n_s_IDX;
static PyObject *__pyx_n_s_INDEX;
static PyObject *__pyx_n_s_INFO;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_n_s_IS_PYTHON3;
static PyObject *__pyx_kp_s_I_O_operation_on_closed_file;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_s_Integer;
static PyObject *__pyx_kp_s_Invalid_filter;
static PyObject *__pyx_kp_s_Invalid_index_object;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_NONE;
static PyObject *__pyx_n_s_OSError;
static PyObject *__pyx_n_s_PASS;
static PyObject *__pyx_n_s_R;
static PyObject *__pyx_n_s_REGIONS;
static PyObject *__pyx_n_s_SAM;
static PyObject *__pyx_n_s_STRUCTURED;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_String;
static PyObject *__pyx_n_s_TBI;
static PyObject *__pyx_n_s_TEXT_FORMAT;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UNKNOWN;
static PyObject *__pyx_kp_s_Unknown_INFO_field;
static PyObject *__pyx_n_s_VARIABLE;
static PyObject *__pyx_n_s_VARIANTS;
static PyObject *__pyx_n_s_VCF;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_VariantFile;
static PyObject *__pyx_n_s_VariantHeader;
static PyObject *__pyx_n_s_VariantHeaderContigs___iter;
static PyObject *__pyx_n_s_VariantHeaderContigs_iteritems;
static PyObject *__pyx_n_s_VariantHeaderContigs_itervalues;
static PyObject *__pyx_n_s_VariantHeaderMetadata___iter;
static PyObject *__pyx_n_s_VariantHeaderMetadata_iteritems;
static PyObject *__pyx_n_s_VariantHeaderMetadata_itervalues;
static PyObject *__pyx_n_s_VariantHeaderRecord___get___loca;
static PyObject *__pyx_n_s_VariantHeaderRecords___iter;
static PyObject *__pyx_n_s_VariantHeaderSamples___iter;
static PyObject *__pyx_n_s_VariantRecordFilter___iter;
static PyObject *__pyx_n_s_VariantRecordFilter_iteritems;
static PyObject *__pyx_n_s_VariantRecordFilter_itervalues;
static PyObject *__pyx_n_s_VariantRecordFormat___iter;
static PyObject *__pyx_n_s_VariantRecordFormat_iteritems;
static PyObject *__pyx_n_s_VariantRecordFormat_itervalues;
static PyObject *__pyx_n_s_VariantRecordInfo___iter;
static PyObject *__pyx_n_s_VariantRecordInfo_iteritems;
static PyObject *__pyx_n_s_VariantRecordInfo_itervalues;
static PyObject *__pyx_n_s_VariantRecordSample___iter;
static PyObject *__pyx_n_s_VariantRecordSample_iteritems;
static PyObject *__pyx_n_s_VariantRecordSample_itervalues;
static PyObject *__pyx_n_s_VariantRecordSamples___iter;
static PyObject *__pyx_n_s_VariantRecordSamples_iteritems;
static PyObject *__pyx_n_s_VariantRecordSamples_itervalues;
static PyObject *__pyx_n_s_VariantRecord___get___locals_gen;
static PyObject *__pyx_kp_s_Variant_read_failed;
static PyObject *__pyx_kp_s__10;
static PyObject *__pyx_kp_b__14;
static PyObject *__pyx_kp_s__14;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_kp_s__8;
static PyObject *__pyx_kp_b__82;
static PyObject *__pyx_kp_s__9;
static PyObject *__pyx_kp_s_a_VariantHeader_must_be_specifie;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_alleles;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_attrs;
static PyObject *__pyx_n_s_bcf;
static PyObject *__pyx_kp_s_bcf_hdr_set_samples_failed_ret;
static PyObject *__pyx_kp_s_bcf_index_required;
static PyObject *__pyx_kp_s_cannot_create_VariantHeader;
static PyObject *__pyx_kp_s_cannot_create_VariantRecord;
static PyObject *__pyx_kp_s_cannot_create_VariantRecordSampl;
static PyObject *__pyx_kp_s_cannot_fetch_from_Variantfile_op;
static PyObject *__pyx_kp_s_cannot_iterate_over_Variantfile;
static PyObject *__pyx_kp_s_cannot_subset_samples_after_fetc;
static PyObject *__pyx_kp_s_cannot_subset_samples_from_Varia;
static PyObject *__pyx_n_s_char_array_to_tuple_locals_genex;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_contig;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_kp_s_could_not_open_file_mode;
static PyObject *__pyx_kp_s_could_not_open_file_mode_is_it_V;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_drop_samples;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_kp_s_error_in_bcf_subset_format;
static PyObject *__pyx_kp_s_error_in_vcf_parse;
static PyObject *__pyx_kp_s_error_reading_BCF_file;
static PyObject *__pyx_kp_s_error_reading_indexed_VCF_file;
static PyObject *__pyx_n_s_exc_type;
static PyObject *__pyx_n_s_exc_value;
static PyObject *__pyx_n_s_exists;
static PyObject *__pyx_n_s_fetch;
static PyObject *__pyx_kp_s_fetch_requires_an_index;
static PyObject *__pyx_kp_s_file_does_not_have_valid_header;
static PyObject *__pyx_kp_s_file_not_found;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_kp_b_ftp;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getdefaultencoding;
static PyObject *__pyx_n_s_getfilesystemencoding;
static PyObject *__pyx_n_s_hash;
static PyObject *__pyx_n_s_header;
static PyObject *__pyx_kp_b_http;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_kp_s_invalid_VariantHeader;
static PyObject *__pyx_kp_s_invalid_VariantRecord;
static PyObject *__pyx_kp_s_invalid_contig;
static PyObject *__pyx_kp_s_invalid_contig_id;
static PyObject *__pyx_kp_s_invalid_contig_index;
static PyObject *__pyx_kp_s_invalid_file_opening_mode;
static PyObject *__pyx_kp_s_invalid_filter;
static PyObject *__pyx_kp_s_invalid_filter_index;
static PyObject *__pyx_kp_s_invalid_format_index;
static PyObject *__pyx_kp_s_invalid_format_requested;
static PyObject *__pyx_kp_s_invalid_header_mode_specified;
static PyObject *__pyx_kp_s_invalid_header_record_index;
static PyObject *__pyx_kp_s_invalid_metadata_id;
static PyObject *__pyx_kp_s_invalid_metadata_type;
static PyObject *__pyx_kp_s_invalid_sample_index;
static PyObject *__pyx_kp_s_invalid_sample_name;
static PyObject *__pyx_n_s_is_open;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_itervalues;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_kp_s_metadata_not_available_on_closed;
static PyObject *__pyx_kp_s_missing_d_requested_samples;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_b_r;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_rU;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rb;
static PyObject *__pyx_n_s_region;
static PyObject *__pyx_n_s_remap;
static PyObject *__pyx_n_s_reopen;
static PyObject *__pyx_n_s_rw;
static PyObject *__pyx_n_s_samples;
static PyObject *__pyx_n_s_seek;
static PyObject *__pyx_kp_s_seek_not_available_in_streams;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_str___locals_genexpr;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_kp_s_tabix_index_required;
static PyObject *__pyx_kp_s_tbi;
static PyObject *__pyx_n_s_tell;
static PyObject *__pyx_kp_s_tell_not_available_in_streams;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_kp_s_truncated_file;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_kp_s_unknown_format;
static PyObject *__pyx_kp_s_unsupported_info_type_code;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_kp_s_vcf_format_failed;
static PyObject *__pyx_n_b_w;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_wb;
static PyObject *__pyx_n_b_wb0;
static PyObject *__pyx_n_s_wb0;
static PyObject *__pyx_n_b_wbu;
static PyObject *__pyx_n_s_wbu;
static PyObject *__pyx_n_s_wh;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_kp_s_write_failed;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__100;

/* "pysam/cbcf.pyx":234
 * 
 * 
 * cdef bytes encode_filename(object filename):             # <<<<<<<<<<<<<<
 *     """Make sure a filename is 8-bit encoded (or None)."""
 *     if filename is None:
 */

static PyObject *__pyx_f_5pysam_4cbcf_encode_filename(PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("encode_filename", 0);
  __Pyx_TraceCall("encode_filename", __pyx_f[0], 234);

  /* "pysam/cbcf.pyx":236
 * cdef bytes encode_filename(object filename):
 *     """Make sure a filename is 8-bit encoded (or None)."""
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif PyBytes_Check(filename):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":237
 *     """Make sure a filename is 8-bit encoded (or None)."""
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif PyBytes_Check(filename):
 *         return filename
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = ((PyObject*)Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":238
 *     if filename is None:
 *         return None
 *     elif PyBytes_Check(filename):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif PyUnicode_Check(filename):
 */
  __pyx_t_2 = (PyBytes_Check(__pyx_v_filename) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":239
 *         return None
 *     elif PyBytes_Check(filename):
 *         return filename             # <<<<<<<<<<<<<<
 *     elif PyUnicode_Check(filename):
 *         return filename.encode(FILENAME_ENCODING)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyBytes_CheckExact(__pyx_v_filename))||((__pyx_v_filename) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_filename)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_filename);
    __pyx_r = ((PyObject*)__pyx_v_filename);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":240
 *     elif PyBytes_Check(filename):
 *         return filename
 *     elif PyUnicode_Check(filename):             # <<<<<<<<<<<<<<
 *         return filename.encode(FILENAME_ENCODING)
 *     else:
 */
  __pyx_t_2 = (PyUnicode_Check(__pyx_v_filename) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":241
 *         return filename
 *     elif PyUnicode_Check(filename):
 *         return filename.encode(FILENAME_ENCODING)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('Argument must be string or unicode.')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_5pysam_4cbcf_FILENAME_ENCODING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
      __Pyx_GIVEREF(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":243
 *         return filename.encode(FILENAME_ENCODING)
 *     else:
 *         raise TypeError('Argument must be string or unicode.')             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":234
 * 
 * 
 * cdef bytes encode_filename(object filename):             # <<<<<<<<<<<<<<
 *     """Make sure a filename is 8-bit encoded (or None)."""
 *     if filename is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.encode_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":246
 * 
 * 
 * cdef force_str(object s):             # <<<<<<<<<<<<<<
 *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
 *     if s is None:
 */

static PyObject *__pyx_f_5pysam_4cbcf_force_str(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("force_str", 0);
  __Pyx_TraceCall("force_str", __pyx_f[0], 246);

  /* "pysam/cbcf.pyx":248
 * cdef force_str(object s):
 *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
 *     if s is None:             # <<<<<<<<<<<<<<
 *         return None
 *     if PY_MAJOR_VERSION < 3:
 */
  __pyx_t_1 = (__pyx_v_s == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":249
 *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
 *     if s is None:
 *         return None             # <<<<<<<<<<<<<<
 *     if PY_MAJOR_VERSION < 3:
 *         return s
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":250
 *     if s is None:
 *         return None
 *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
 *         return s
 *     elif PyBytes_Check(s):
 */
  __pyx_t_2 = ((PY_MAJOR_VERSION < 3) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":251
 *         return None
 *     if PY_MAJOR_VERSION < 3:
 *         return s             # <<<<<<<<<<<<<<
 *     elif PyBytes_Check(s):
 *         return s.decode('ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = __pyx_v_s;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":252
 *     if PY_MAJOR_VERSION < 3:
 *         return s
 *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
 *         return s.decode('ascii')
 *     else:
 */
  __pyx_t_2 = (PyBytes_Check(__pyx_v_s) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":253
 *         return s
 *     elif PyBytes_Check(s):
 *         return s.decode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         # assume unicode
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __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;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":256
 *     else:
 *         # assume unicode
 *         return s             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = __pyx_v_s;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":246
 * 
 * 
 * cdef force_str(object s):             # <<<<<<<<<<<<<<
 *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
 *     if s is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":259
 * 
 * 
 * cdef bytes force_bytes(object s):             # <<<<<<<<<<<<<<
 *     """convert string or unicode object to bytes, assuming ascii encoding."""
 *     if PY_MAJOR_VERSION < 3:
 */

static PyObject *__pyx_f_5pysam_4cbcf_force_bytes(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("force_bytes", 0);
  __Pyx_TraceCall("force_bytes", __pyx_f[0], 259);

  /* "pysam/cbcf.pyx":261
 * cdef bytes force_bytes(object s):
 *     """convert string or unicode object to bytes, assuming ascii encoding."""
 *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
 *         return s
 *     elif s is None:
 */
  __pyx_t_1 = ((PY_MAJOR_VERSION < 3) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":262
 *     """convert string or unicode object to bytes, assuming ascii encoding."""
 *     if PY_MAJOR_VERSION < 3:
 *         return s             # <<<<<<<<<<<<<<
 *     elif s is None:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = ((PyObject*)__pyx_v_s);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":263
 *     if PY_MAJOR_VERSION < 3:
 *         return s
 *     elif s is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif PyBytes_Check(s):
 */
  __pyx_t_1 = (__pyx_v_s == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":264
 *         return s
 *     elif s is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif PyBytes_Check(s):
 *         return s
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = ((PyObject*)Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":265
 *     elif s is None:
 *         return None
 *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
 *         return s
 *     elif PyUnicode_Check(s):
 */
  __pyx_t_2 = (PyBytes_Check(__pyx_v_s) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":266
 *         return None
 *     elif PyBytes_Check(s):
 *         return s             # <<<<<<<<<<<<<<
 *     elif PyUnicode_Check(s):
 *         return s.encode('ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = ((PyObject*)__pyx_v_s);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":267
 *     elif PyBytes_Check(s):
 *         return s
 *     elif PyUnicode_Check(s):             # <<<<<<<<<<<<<<
 *         return s.encode('ascii')
 *     else:
 */
  __pyx_t_2 = (PyUnicode_Check(__pyx_v_s) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":268
 *         return s
 *     elif PyUnicode_Check(s):
 *         return s.encode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('Argument must be string, bytes or unicode.')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":270
 *         return s.encode('ascii')
 *     else:
 *         raise TypeError('Argument must be string, bytes or unicode.')             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":259
 * 
 * 
 * cdef bytes force_bytes(object s):             # <<<<<<<<<<<<<<
 *     """convert string or unicode object to bytes, assuming ascii encoding."""
 *     if PY_MAJOR_VERSION < 3:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":273
 * 
 * 
 * cdef charptr_to_str(const char* s):             # <<<<<<<<<<<<<<
 *     if PY_MAJOR_VERSION < 3:
 *         return s
 */

static PyObject *__pyx_f_5pysam_4cbcf_charptr_to_str(char const *__pyx_v_s) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("charptr_to_str", 0);
  __Pyx_TraceCall("charptr_to_str", __pyx_f[0], 273);

  /* "pysam/cbcf.pyx":274
 * 
 * cdef charptr_to_str(const char* s):
 *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
 *         return s
 *     else:
 */
  __pyx_t_1 = ((PY_MAJOR_VERSION < 3) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":275
 * cdef charptr_to_str(const char* s):
 *     if PY_MAJOR_VERSION < 3:
 *         return s             # <<<<<<<<<<<<<<
 *     else:
 *         return s.decode('ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":277
 *         return s
 *     else:
 *         return s.decode('ascii')             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":273
 * 
 * 
 * cdef charptr_to_str(const char* s):             # <<<<<<<<<<<<<<
 *     if PY_MAJOR_VERSION < 3:
 *         return s
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19char_array_to_tuple_2generator25(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":290
 *         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_4cbcf_19char_array_to_tuple_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_1_genexpr(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 290);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19char_array_to_tuple_2generator25, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_char_array_to_tuple_locals_genex); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.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_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19char_array_to_tuple_2generator25(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;
    __pyx_t_3 = __pyx_f_5pysam_4cbcf_charptr_to_str((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

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

static PyObject *__pyx_f_5pysam_4cbcf_char_array_to_tuple(char const **__pyx_v_a, int __pyx_v_n, struct __pyx_opt_args_5pysam_4cbcf_char_array_to_tuple *__pyx_optional_args) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *__pyx_cur_scope;
  int __pyx_v_free_after = ((int)0);
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("char_array_to_tuple", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return 0;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("char_array_to_tuple", __pyx_f[0], 286);
  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;
  __pyx_cur_scope->__pyx_v_n = __pyx_v_n;

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

    /* "pysam/cbcf.pyx":288
 * cdef tuple char_array_to_tuple(const char **a, int 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_INCREF(Py_None);
    __pyx_r = ((PyObject*)Py_None);
    goto __pyx_L0;
  }

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

    /* "pysam/cbcf.pyx":290
 *         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_4cbcf_19char_array_to_tuple_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L4_return;
  }

  /* "pysam/cbcf.pyx":292
 *          return tuple( charptr_to_str(a[i]) for i in range(n) )
 *     finally:
 *         if free_after and a:             # <<<<<<<<<<<<<<
 *             free(a)
 * 
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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/cbcf.pyx":293
 *     finally:
 *         if free_after and a:
 *             free(a)             # <<<<<<<<<<<<<<
 * 
 * 
 */
          free(__pyx_cur_scope->__pyx_v_a);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
      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;

      /* "pysam/cbcf.pyx":292
 *          return tuple( charptr_to_str(a[i]) for i in range(n) )
 *     finally:
 *         if free_after and a:             # <<<<<<<<<<<<<<
 *             free(a)
 * 
 */
      __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/cbcf.pyx":293
 *     finally:
 *         if free_after and a:
 *             free(a)             # <<<<<<<<<<<<<<
 * 
 * 
 */
        free(__pyx_cur_scope->__pyx_v_a);
        goto __pyx_L12;
      }
      __pyx_L12:;
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "pysam/cbcf.pyx":286
 * 
 * 
 * cdef tuple char_array_to_tuple(const char **a, int 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.cbcf.char_array_to_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":296
 * 
 * 
 * cdef bcf_array_to_object(void *data, int type, int n, int scalar=0):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
 */

static PyObject *__pyx_f_5pysam_4cbcf_bcf_array_to_object(void *__pyx_v_data, int __pyx_v_type, int __pyx_v_n, struct __pyx_opt_args_5pysam_4cbcf_bcf_array_to_object *__pyx_optional_args) {
  int __pyx_v_scalar = ((int)0);
  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_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("bcf_array_to_object", 0);
  __Pyx_TraceCall("bcf_array_to_object", __pyx_f[0], 296);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_scalar = __pyx_optional_args->scalar;
    }
  }

  /* "pysam/cbcf.pyx":304
 *     cdef int      i
 * 
 *     if not data or n <= 0:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_data != 0)) != 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) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

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

  /* "pysam/cbcf.pyx":307
 *         return None
 * 
 *     if type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         datac = <char *>data
 *         value = datac[:n] if datac[0] != bcf_str_missing else None
 */
  __pyx_t_1 = ((__pyx_v_type == BCF_BT_CHAR) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":308
 * 
 *     if type == BCF_BT_CHAR:
 *         datac = <char *>data             # <<<<<<<<<<<<<<
 *         value = datac[:n] if datac[0] != bcf_str_missing else None
 *     else:
 */
    __pyx_v_datac = ((char *)__pyx_v_data);

    /* "pysam/cbcf.pyx":309
 *     if type == BCF_BT_CHAR:
 *         datac = <char *>data
 *         value = datac[:n] if datac[0] != bcf_str_missing else None             # <<<<<<<<<<<<<<
 *     else:
 *         value = []
 */
    if ((((__pyx_v_datac[0]) != bcf_str_missing) != 0)) {
      __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_datac + 0, __pyx_v_n - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __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_v_value = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":311
 *         value = datac[:n] if datac[0] != bcf_str_missing else None
 *     else:
 *         value = []             # <<<<<<<<<<<<<<
 *         if type == BCF_BT_INT8:
 *             data8 = <int8_t *>data
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pysam/cbcf.pyx":312
 *     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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":313
 *         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/cbcf.pyx":314
 *         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;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pysam/cbcf.pyx":315
 *             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) != 0);
        if (__pyx_t_1) {

          /* "pysam/cbcf.pyx":316
 *             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_L9_break;
        }

        /* "pysam/cbcf.pyx":317
 *                 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
 */
        if ((((__pyx_v_data8[__pyx_v_i]) != bcf_int8_missing) != 0)) {
          __pyx_t_4 = __Pyx_PyInt_From_int8_t((__pyx_v_data8[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __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_t_7 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L9_break:;
      goto __pyx_L7;
    }

    /* "pysam/cbcf.pyx":318
 *                     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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":319
 *                 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/cbcf.pyx":320
 *         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;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pysam/cbcf.pyx":321
 *             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) != 0);
        if (__pyx_t_1) {

          /* "pysam/cbcf.pyx":322
 *             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_L12_break;
        }

        /* "pysam/cbcf.pyx":323
 *                 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
 */
        if ((((__pyx_v_data16[__pyx_v_i]) != bcf_int16_missing) != 0)) {
          __pyx_t_4 = __Pyx_PyInt_From_int16_t((__pyx_v_data16[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __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_t_7 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L12_break:;
      goto __pyx_L7;
    }

    /* "pysam/cbcf.pyx":324
 *                     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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":325
 *                 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/cbcf.pyx":326
 *         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;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pysam/cbcf.pyx":327
 *             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) != 0);
        if (__pyx_t_1) {

          /* "pysam/cbcf.pyx":328
 *             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_L15_break;
        }

        /* "pysam/cbcf.pyx":329
 *                 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
 */
        if ((((__pyx_v_data32[__pyx_v_i]) != bcf_int32_missing) != 0)) {
          __pyx_t_4 = __Pyx_PyInt_From_int32_t((__pyx_v_data32[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __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_t_7 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L15_break:;
      goto __pyx_L7;
    }

    /* "pysam/cbcf.pyx":330
 *                     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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":331
 *                 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/cbcf.pyx":332
 *         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;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pysam/cbcf.pyx":333
 *             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/cbcf.pyx":334
 *             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_L18_break;
        }

        /* "pysam/cbcf.pyx":335
 *                 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')
 */
        if (((!(bcf_float_is_missing((__pyx_v_dataf[__pyx_v_i])) != 0)) != 0)) {
          __pyx_t_4 = PyFloat_FromDouble((__pyx_v_dataf[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __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_t_7 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L18_break:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":337
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 * 
 *         if not value:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L7:;

    /* "pysam/cbcf.pyx":339
 *             raise TypeError('unsupported info type code')
 * 
 *         if not value:             # <<<<<<<<<<<<<<
 *             value = None
 *         elif scalar and len(value) == 1:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = ((!__pyx_t_1) != 0);
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":340
 * 
 *         if not value:
 *             value = None             # <<<<<<<<<<<<<<
 *         elif scalar and len(value) == 1:
 *             value = value[0]
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_value, Py_None);
      goto __pyx_L20;
    }

    /* "pysam/cbcf.pyx":341
 *         if not value:
 *             value = None
 *         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_L21_bool_binop_done;
    }
    __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_8 == 1) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L21_bool_binop_done:;
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":342
 *             value = None
 *         elif scalar and len(value) == 1:
 *             value = value[0]             # <<<<<<<<<<<<<<
 *         else:
 *             value = tuple(value)
 */
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L20;
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":344
 *             value = value[0]
 *         else:
 *             value = tuple(value)             # <<<<<<<<<<<<<<
 * 
 *     return value
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L20:;
  }
  __pyx_L6:;

  /* "pysam/cbcf.pyx":346
 *             value = tuple(value)
 * 
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":296
 * 
 * 
 * cdef bcf_array_to_object(void *data, int type, int n, int scalar=0):             # <<<<<<<<<<<<<<
 *     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.cbcf.bcf_array_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":349
 * 
 * 
 * cdef object bcf_info_value(const bcf_info_t *z):             # <<<<<<<<<<<<<<
 *     cdef char *s
 * 
 */

static PyObject *__pyx_f_5pysam_4cbcf_bcf_info_value(bcf_info_t const *__pyx_v_z) {
  char *__pyx_v_s;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("bcf_info_value", 0);
  __Pyx_TraceCall("bcf_info_value", __pyx_f[0], 349);

  /* "pysam/cbcf.pyx":352
 *     cdef char *s
 * 
 *     if not z:             # <<<<<<<<<<<<<<
 *         return None
 *     elif z.len == 0:
 */
  __pyx_t_1 = ((!(__pyx_v_z != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":353
 * 
 *     if not z:
 *         return None             # <<<<<<<<<<<<<<
 *     elif z.len == 0:
 *         value = True
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":354
 *     if not z:
 *         return None
 *     elif z.len == 0:             # <<<<<<<<<<<<<<
 *         value = True
 *     elif z.len == 1:
 */
  __pyx_t_1 = ((__pyx_v_z->len == 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":355
 *         return None
 *     elif z.len == 0:
 *         value = True             # <<<<<<<<<<<<<<
 *     elif z.len == 1:
 *         if z.type == BCF_BT_INT8:
 */
    __Pyx_INCREF(Py_True);
    __pyx_v_value = Py_True;
    goto __pyx_L3;
  }

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

    /* "pysam/cbcf.pyx":357
 *         value = True
 *     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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":358
 *     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
 */
      if (((__pyx_v_z->v1.i != bcf_int8_missing) != 0)) {
        __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }

    /* "pysam/cbcf.pyx":359
 *         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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":360
 *             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
 */
      if (((__pyx_v_z->v1.i != bcf_int16_missing) != 0)) {
        __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }

    /* "pysam/cbcf.pyx":361
 *         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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":362
 *             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
 */
      if (((__pyx_v_z->v1.i != bcf_int32_missing) != 0)) {
        __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }

    /* "pysam/cbcf.pyx":363
 *         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) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":364
 *             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:
 *             s = <char *>&z.v1.i
 */
      if (((!(bcf_float_is_missing(__pyx_v_z->v1.f) != 0)) != 0)) {
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_z->v1.f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }

    /* "pysam/cbcf.pyx":365
 *         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:             # <<<<<<<<<<<<<<
 *             s = <char *>&z.v1.i
 *             value = s if not s or s[0] != bcf_str_missing else None
 */
    __pyx_t_1 = ((__pyx_v_z->type == BCF_BT_CHAR) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":366
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:
 *             s = <char *>&z.v1.i             # <<<<<<<<<<<<<<
 *             value = s if not s or s[0] != bcf_str_missing else None
 *         else:
 */
      __pyx_v_s = ((char *)(&__pyx_v_z->v1.i));

      /* "pysam/cbcf.pyx":367
 *         elif z.type == BCF_BT_CHAR:
 *             s = <char *>&z.v1.i
 *             value = s if not s or s[0] != bcf_str_missing else None             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('unsupported info type code')
 */
      __pyx_t_4 = ((!(__pyx_v_s != 0)) != 0);
      if (!__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L5_bool_binop_done;
      }
      __pyx_t_4 = (((__pyx_v_s[0]) != bcf_str_missing) != 0);
      __pyx_t_1 = __pyx_t_4;
      __pyx_L5_bool_binop_done:;
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":369
 *             value = s if not s or s[0] != bcf_str_missing else None
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 *     else:
 *         value = bcf_array_to_object(z.vptr, z.type, z.len)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":371
 *             raise TypeError('unsupported info type code')
 *     else:
 *         value = bcf_array_to_object(z.vptr, z.type, z.len)             # <<<<<<<<<<<<<<
 * 
 *     return value
 */
    __pyx_t_2 = __pyx_f_5pysam_4cbcf_bcf_array_to_object(__pyx_v_z->vptr, __pyx_v_z->type, __pyx_v_z->len, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":373
 *         value = bcf_array_to_object(z.vptr, z.type, z.len)
 * 
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":349
 * 
 * 
 * cdef object bcf_info_value(const bcf_info_t *z):             # <<<<<<<<<<<<<<
 *     cdef char *s
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.bcf_info_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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":376
 * 
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *h, bcf_fmt_t *fmt):             # <<<<<<<<<<<<<<
 *     return strcmp(bcf_hdr_int2id(h, BCF_DT_ID, fmt.id), "GT") == 0
 * 
 */

static CYTHON_INLINE int __pyx_f_5pysam_4cbcf_is_gt_fmt(bcf_hdr_t *__pyx_v_h, bcf_fmt_t *__pyx_v_fmt) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("is_gt_fmt", 0);
  __Pyx_TraceCall("is_gt_fmt", __pyx_f[0], 376);

  /* "pysam/cbcf.pyx":377
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *h, bcf_fmt_t *fmt):
 *     return strcmp(bcf_hdr_int2id(h, BCF_DT_ID, fmt.id), "GT") == 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (strcmp(bcf_hdr_int2id(__pyx_v_h, BCF_DT_ID, __pyx_v_fmt->id), __pyx_k_GT) == 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":376
 * 
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *h, bcf_fmt_t *fmt):             # <<<<<<<<<<<<<<
 *     return strcmp(bcf_hdr_int2id(h, BCF_DT_ID, fmt.id), "GT") == 0
 * 
 */

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

/* "pysam/cbcf.pyx":393
 *     property type:
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return METADATA_TYPES[r.type]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_4type___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_4type___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 393);

  /* "pysam/cbcf.pyx":394
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *             return METADATA_TYPES[r.type]
 * 
 */
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":395
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr
 *             return METADATA_TYPES[r.type]             # <<<<<<<<<<<<<<
 * 
 *     property key:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_4cbcf_METADATA_TYPES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_4cbcf_METADATA_TYPES, __pyx_v_r->type, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":393
 *     property type:
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return METADATA_TYPES[r.type]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":399
 *     property key:
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.key if r.key else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_3key_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_3key_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_3key___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_3key___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hrec_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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 399);

  /* "pysam/cbcf.pyx":400
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *             return r.key if r.key else None
 * 
 */
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":401
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.key if r.key else None             # <<<<<<<<<<<<<<
 * 
 *     property value:
 */
  __Pyx_XDECREF(__pyx_r);
  if ((__pyx_v_r->key != 0)) {
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_r->key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":399
 *     property key:
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.key if r.key else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.key.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":405
 *     property value:
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.value if r.value else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5value_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5value_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5value___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5value___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hrec_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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 405);

  /* "pysam/cbcf.pyx":406
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *             return r.value if r.value else None
 * 
 */
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":407
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.value if r.value else None             # <<<<<<<<<<<<<<
 * 
 *     property attrs:
 */
  __Pyx_XDECREF(__pyx_r);
  if ((__pyx_v_r->value != 0)) {
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_r->value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":405
 *     property value:
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             return r.value if r.value else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":411
 *     property attrs:
 *         """sequence of additional header attributes"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5attrs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5attrs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___2generator26(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":414
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 */

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_3_genexpr(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 414);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___2generator26, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantHeaderRecord___get___loca); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.attrs.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___2generator26(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":415
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->nkeys;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "pysam/cbcf.pyx":414
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 */
    if (((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i]) != 0)) {
      __pyx_t_4 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __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;
    }

    /* "pysam/cbcf.pyx":415
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    if (((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]) != 0)) {
      __pyx_t_5 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    }

    /* "pysam/cbcf.pyx":414
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_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_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":411
 *     property attrs:
 *         """sequence of additional header attributes"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 */

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hrec_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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_2___get__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_2___get__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__get__", __pyx_f[0], 411);

  /* "pysam/cbcf.pyx":412
 *         """sequence of additional header attributes"""
 *         def __get__(self):
 *             cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,
 */
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":414
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 *             return tuple( (r.keys[i] if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":411
 *     property attrs:
 *         """sequence of additional header attributes"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *r = self.ptr
 *             cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.attrs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":417
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_1__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_1__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord___str__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_7__str___2generator27(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":422
 *             return '##{}={}'.format(self.key, self.value)
 *         else:
 *             attrs = ','.join('{}={}'.format(k, v) for k,v in self.attrs if k != 'IDX')             # <<<<<<<<<<<<<<
 *             return '##{}=<{}>'.format(self.type, attrs)
 * 
 */

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_7__str___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_5_genexpr(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 422);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_7__str___2generator27, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_str___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantHeaderRecord_7__str___2generator27(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L9_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __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))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_cur_scope->__pyx_v_k, __pyx_n_s_IDX, Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__7, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_10 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_cur_scope->__pyx_v_k);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_k);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_cur_scope->__pyx_v_v);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_v);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __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_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L9_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_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":417
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:
 */

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantHeaderRecord___str__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *__pyx_cur_scope;
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_v_attrs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_4___str__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_4___str__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__str__", __pyx_f[0], 417);
  __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/cbcf.pyx":418
 * 
 *     def __str__(self):
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if r.type == BCF_HL_GEN:
 *             return '##{}={}'.format(self.key, self.value)
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":419
 *     def __str__(self):
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:             # <<<<<<<<<<<<<<
 *             return '##{}={}'.format(self.key, self.value)
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_r->type == BCF_HL_GEN) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":420
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:
 *             return '##{}={}'.format(self.key, self.value)             # <<<<<<<<<<<<<<
 *         else:
 *             attrs = ','.join('{}={}'.format(k, v) for k,v in self.attrs if k != 'IDX')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__8, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_key); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    }
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":422
 *             return '##{}={}'.format(self.key, self.value)
 *         else:
 *             attrs = ','.join('{}={}'.format(k, v) for k,v in self.attrs if k != 'IDX')             # <<<<<<<<<<<<<<
 *             return '##{}=<{}>'.format(self.type, attrs)
 * 
 */
    __pyx_t_3 = __pyx_pf_5pysam_4cbcf_19VariantHeaderRecord_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__9, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_attrs = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":423
 *         else:
 *             attrs = ','.join('{}={}'.format(k, v) for k,v in self.attrs if k != 'IDX')
 *             return '##{}=<{}>'.format(self.type, attrs)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__10, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_8 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_6) {
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    }
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_attrs);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_v_attrs);
    __Pyx_GIVEREF(__pyx_v_attrs);
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":417
 *                            r.vals[i] if r.vals[i] else None) for i in range(r.nkeys) )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if r.type == BCF_HL_GEN:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":426
 * 
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *h):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_f_5pysam_4cbcf_makeVariantHeaderRecord(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, bcf_hrec_t *__pyx_v_h) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__pyx_v_record = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeaderRecord", 0);
  __Pyx_TraceCall("makeVariantHeaderRecord", __pyx_f[0], 426);

  /* "pysam/cbcf.pyx":427
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *h):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":428
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *h):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not h:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":430
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not h:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_h != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":431
 * 
 *     if not h:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":433
 *         return None
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)             # <<<<<<<<<<<<<<
 *     record.header = header
 *     record.ptr = h
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantHeaderRecord(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeaderRecord)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantHeaderRecord)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_record = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":434
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
 *     record.header = header             # <<<<<<<<<<<<<<
 *     record.ptr = h
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_header));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_header));
  __Pyx_GOTREF(__pyx_v_record->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_record->header));
  __pyx_v_record->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":435
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
 *     record.header = header
 *     record.ptr = h             # <<<<<<<<<<<<<<
 * 
 *     return record
 */
  __pyx_v_record->ptr = __pyx_v_h;

  /* "pysam/cbcf.pyx":437
 *     record.ptr = h
 * 
 *     return record             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_record));
  __pyx_r = __pyx_v_record;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":426
 * 
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *h):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":443
 *     """sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords___len__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 443);

  /* "pysam/cbcf.pyx":444
 * 
 *     def __len__(self):
 *         return self.header.ptr.nhrec             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->header->ptr->nhrec;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":443
 *     """sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec
 * 
 */

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

/* "pysam/cbcf.pyx":446
 *         return self.header.ptr.nhrec
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 446);

  /* "pysam/cbcf.pyx":447
 * 
 *     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/cbcf.pyx":446
 *         return self.header.ptr.nhrec
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec != 0
 * 
 */

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

/* "pysam/cbcf.pyx":449
 *         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_4cbcf_20VariantHeaderRecords_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v_index) {
  int32_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 449);

  /* "pysam/cbcf.pyx":450
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_1;

  /* "pysam/cbcf.pyx":451
 *     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) != 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) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":452
 *         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__12, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":453
 *         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_4cbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_4), (__pyx_v_self->header->ptr->hrec[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":449
 *         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.cbcf.VariantHeaderRecords.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderRecords_8generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":455
 *         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_4cbcf_20VariantHeaderRecords_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderRecords_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_6___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_6___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 455);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantHeaderRecords_8generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderRecords___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderRecords.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderRecords_8generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int32_t __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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":457
 *     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;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "pysam/cbcf.pyx":458
 *         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_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->header);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_3), (__pyx_cur_scope->__pyx_v_self->header->ptr->hrec[__pyx_cur_scope->__pyx_v_i]))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":455
 *         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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":463
 * 
 * 
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_f_5pysam_4cbcf_makeVariantHeaderRecords(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__pyx_v_records = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeaderRecords", 0);
  __Pyx_TraceCall("makeVariantHeaderRecords", __pyx_f[0], 463);

  /* "pysam/cbcf.pyx":464
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":465
 * 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__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":467
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)             # <<<<<<<<<<<<<<
 *     records.header = header
 *     return records
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantHeaderRecords(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeaderRecords)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantHeaderRecords)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_records = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":468
 * 
 *     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(__pyx_v_records->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_records->header));
  __pyx_v_records->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":469
 *     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/cbcf.pyx":463
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":476
 *     property name:
 *         """metadata name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_ID][self.id].key
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_15VariantMetadata_4name___get__(((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 476);

  /* "pysam/cbcf.pyx":477
 *         """metadata name"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             return h.id[BCF_DT_ID][self.id].key
 * 
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":478
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_ID][self.id].key             # <<<<<<<<<<<<<<
 * 
 *     # Q: Should this be exposed?
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBytes_FromString(((__pyx_v_h->id[BCF_DT_ID])[__pyx_v_self->id]).key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":476
 *     property name:
 *         """metadata name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_ID][self.id].key
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantMetadata.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":483
 *     property id:
 *         """metadata internal header id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_15VariantMetadata_2id___get__(((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 483);

  /* "pysam/cbcf.pyx":484
 *         """metadata internal header id number"""
 *         def __get__(self):
 *             return self.id             # <<<<<<<<<<<<<<
 * 
 *     property number:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":483
 *     property id:
 *         """metadata internal header id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.id
 * 
 */

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

/* "pysam/cbcf.pyx":488
 *     property number:
 *         """metadata number (i.e. cardinality)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_6number_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_6number_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_15VariantMetadata_6number___get__(((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_6number___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_l;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 488);

  /* "pysam/cbcf.pyx":489
 *         """metadata number (i.e. cardinality)"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":490
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *                 return None
 *             cdef int l = bcf_hdr_id2length(h, self.type, self.id)
 */
  __pyx_t_3 = ((!(bcf_hdr_idinfo_exists(__pyx_v_h, __pyx_v_self->type, __pyx_v_self->id) != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_self->type == BCF_HL_FLT) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":491
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None             # <<<<<<<<<<<<<<
 *             cdef int l = bcf_hdr_id2length(h, self.type, self.id)
 *             if l == BCF_VL_FIXED:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":492
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None
 *             cdef int l = bcf_hdr_id2length(h, self.type, self.id)             # <<<<<<<<<<<<<<
 *             if l == BCF_VL_FIXED:
 *                 return bcf_hdr_id2number(h, self.type, self.id)
 */
  __pyx_v_l = bcf_hdr_id2length(__pyx_v_h, __pyx_v_self->type, __pyx_v_self->id);

  /* "pysam/cbcf.pyx":493
 *                 return None
 *             cdef int l = bcf_hdr_id2length(h, self.type, self.id)
 *             if l == BCF_VL_FIXED:             # <<<<<<<<<<<<<<
 *                 return bcf_hdr_id2number(h, self.type, self.id)
 *             elif l == BCF_VL_VAR:
 */
  __pyx_t_2 = ((__pyx_v_l == BCF_VL_FIXED) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":494
 *             cdef int l = bcf_hdr_id2length(h, self.type, self.id)
 *             if l == BCF_VL_FIXED:
 *                 return bcf_hdr_id2number(h, 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_h, __pyx_v_self->type, __pyx_v_self->id)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":495
 *             if l == BCF_VL_FIXED:
 *                 return bcf_hdr_id2number(h, self.type, self.id)
 *             elif l == BCF_VL_VAR:             # <<<<<<<<<<<<<<
 *                 return '.'
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_l == BCF_VL_VAR) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":496
 *                 return bcf_hdr_id2number(h, self.type, self.id)
 *             elif l == BCF_VL_VAR:
 *                 return '.'             # <<<<<<<<<<<<<<
 *             else:
 *                 return METADATA_LENGTHS[l]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s__14);
    __pyx_r = __pyx_kp_s__14;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":498
 *                 return '.'
 *             else:
 *                 return METADATA_LENGTHS[l]             # <<<<<<<<<<<<<<
 * 
 *     property type:
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_5pysam_4cbcf_METADATA_LENGTHS == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_4cbcf_METADATA_LENGTHS, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":488
 *     property number:
 *         """metadata number (i.e. cardinality)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantMetadata.number.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":502
 *     property type:
 *         """metadata value type"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_15VariantMetadata_4type___get__(((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_4type___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 502);

  /* "pysam/cbcf.pyx":503
 *         """metadata value type"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":504
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *                 return None
 *             return VALUE_TYPES[bcf_hdr_id2type(h, self.type, self.id)]
 */
  __pyx_t_3 = ((!(bcf_hdr_idinfo_exists(__pyx_v_h, __pyx_v_self->type, __pyx_v_self->id) != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_self->type == BCF_HL_FLT) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":505
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None             # <<<<<<<<<<<<<<
 *             return VALUE_TYPES[bcf_hdr_id2type(h, self.type, self.id)]
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":506
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 *                 return None
 *             return VALUE_TYPES[bcf_hdr_id2type(h, self.type, self.id)]             # <<<<<<<<<<<<<<
 * 
 *     property header:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_4cbcf_VALUE_TYPES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = bcf_hdr_id2type(__pyx_v_h, __pyx_v_self->type, __pyx_v_self->id);
  __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_4cbcf_VALUE_TYPES, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":502
 *     property type:
 *         """metadata value type"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id) or self.type == BCF_HL_FLT:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.VariantMetadata.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":510
 *     property header:
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_15VariantMetadata_6header_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_15VariantMetadata_6header___get__(((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_15VariantMetadata_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hdr_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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 510);

  /* "pysam/cbcf.pyx":511
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):
 *                 return None
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":512
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):             # <<<<<<<<<<<<<<
 *                 return None
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_ID][self.id].val.hrec[self.type]
 */
  __pyx_t_2 = ((!(bcf_hdr_idinfo_exists(__pyx_v_h, __pyx_v_self->type, __pyx_v_self->id) != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":513
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):
 *                 return None             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *             if not hrec:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":514
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):
 *                 return None
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_ID][self.id].val.hrec[self.type]             # <<<<<<<<<<<<<<
 *             if not hrec:
 *                 return None
 */
  __pyx_v_hrec = (((__pyx_v_h->id[BCF_DT_ID])[__pyx_v_self->id]).val->hrec[__pyx_v_self->type]);

  /* "pysam/cbcf.pyx":515
 *                 return None
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *             if not hrec:             # <<<<<<<<<<<<<<
 *                 return None
 *             return makeVariantHeaderRecord(self.header, hrec)
 */
  __pyx_t_2 = ((!(__pyx_v_hrec != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":516
 *             cdef bcf_hrec_t *hrec = h.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_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":517
 *             if not hrec:
 *                 return None
 *             return makeVariantHeaderRecord(self.header, hrec)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_3), __pyx_v_hrec)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":510
 *     property header:
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             if not bcf_hdr_idinfo_exists(h, self.type, self.id):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantMetadata.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":520
 * 
 * 
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_f_5pysam_4cbcf_makeVariantMetadata(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, int __pyx_v_type, int __pyx_v_id) {
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__pyx_v_meta = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantMetadata", 0);
  __Pyx_TraceCall("makeVariantMetadata", __pyx_f[0], 520);

  /* "pysam/cbcf.pyx":521
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":522
 * 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__15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":524
 *         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) != 0);
  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) != 0);
  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) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":525
 * 
 *     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__16, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":527
 *         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) != 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])) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":528
 * 
 *     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__17, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":530
 *         raise ValueError('invalid metadata id')
 * 
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)             # <<<<<<<<<<<<<<
 *     meta.header = header
 *     meta.type = type
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantMetadata(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantMetadata)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantMetadata)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_meta = ((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":531
 * 
 *     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(__pyx_v_meta->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_meta->header));
  __pyx_v_meta->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":532
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)
 *     meta.header = header
 *     meta.type = type             # <<<<<<<<<<<<<<
 *     meta.id = id
 * 
 */
  __pyx_v_meta->type = __pyx_v_type;

  /* "pysam/cbcf.pyx":533
 *     meta.header = header
 *     meta.type = type
 *     meta.id = id             # <<<<<<<<<<<<<<
 * 
 *     return meta
 */
  __pyx_v_meta->id = __pyx_v_id;

  /* "pysam/cbcf.pyx":535
 *     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/cbcf.pyx":520
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":541
 *     """mapping from filter, info or format name to :class:`VariantMetadata` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata___len__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  bcf_idpair_t *__pyx_v_idpair;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 541);

  /* "pysam/cbcf.pyx":542
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i, n = 0
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":544
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i, n = 0             # <<<<<<<<<<<<<<
 * 
 *         for i in range(h.n[BCF_DT_ID]):
 */
  __pyx_v_n = 0;

  /* "pysam/cbcf.pyx":546
 *         cdef int32_t i, n = 0
 * 
 *         for i in range(h.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 */
  __pyx_t_2 = (__pyx_v_h->n[BCF_DT_ID]);
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysam/cbcf.pyx":547
 * 
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.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_h->id[BCF_DT_ID]) + __pyx_v_i);

    /* "pysam/cbcf.pyx":548
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 n += 1
 * 
 */
    __pyx_t_5 = (__pyx_v_idpair->key != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_idpair->val != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = ((((__pyx_v_idpair->val->info[__pyx_v_self->type]) & 0xF) != 0xF) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {

      /* "pysam/cbcf.pyx":549
 *             idpair = h.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);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pysam/cbcf.pyx":551
 *                 n += 1
 * 
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_n;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":541
 *     """mapping from filter, info or format name to :class:`VariantMetadata` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

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

/* "pysam/cbcf.pyx":553
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  bcf_idpair_t *__pyx_v_idpair;
  int32_t __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 553);

  /* "pysam/cbcf.pyx":554
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":558
 *         cdef int32_t i
 * 
 *         for i in range(h.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 */
  __pyx_t_2 = (__pyx_v_h->n[BCF_DT_ID]);
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysam/cbcf.pyx":559
 * 
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.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_h->id[BCF_DT_ID]) + __pyx_v_i);

    /* "pysam/cbcf.pyx":560
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    __pyx_t_5 = (__pyx_v_idpair->key != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_idpair->val != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = ((((__pyx_v_idpair->val->info[__pyx_v_self->type]) & 0xF) != 0xF) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {

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

  /* "pysam/cbcf.pyx":553
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

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

/* "pysam/cbcf.pyx":565
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_ID]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  vdict_t *__pyx_v_d;
  khiter_t __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  char const *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 565);

  /* "pysam/cbcf.pyx":566
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_ID]
 *         cdef khiter_t k = kh_get_vdict(d, key)
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":567
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_ID]             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 */
  __pyx_v_d = ((vdict_t *)(__pyx_v_h->dict[BCF_DT_ID]));

  /* "pysam/cbcf.pyx":568
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_ID]
 *         cdef khiter_t k = kh_get_vdict(d, key)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/cbcf.pyx":570
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid filter')
 * 
 */
  __pyx_t_4 = ((__pyx_v_k == kh_end(__pyx_v_d)) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((((kh_val(__pyx_v_d, __pyx_v_k).info[__pyx_v_self->type]) & 0xF) == 0xF) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":571
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
 *             raise KeyError('invalid filter')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":573
 *             raise KeyError('invalid filter')
 * 
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_5), __pyx_v_self->type, kh_val(__pyx_v_d, __pyx_v_k).id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":565
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_ID]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_8generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":575
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_7___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 575);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_8generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderMetadata___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_8generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":576
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = 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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":580
 *         cdef int32_t i
 * 
 *         for i in range(h.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = h.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_h->n[BCF_DT_ID]);
  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/cbcf.pyx":581
 * 
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.id[BCF_DT_ID] + i             # <<<<<<<<<<<<<<
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 yield idpair.key
 */
    __pyx_cur_scope->__pyx_v_idpair = ((__pyx_cur_scope->__pyx_v_h->id[BCF_DT_ID]) + __pyx_cur_scope->__pyx_v_i);

    /* "pysam/cbcf.pyx":582
 *         for i in range(h.n[BCF_DT_ID]):
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 yield idpair.key
 * 
 */
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_idpair->key != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_idpair->val != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_5 = ((((__pyx_cur_scope->__pyx_v_idpair->val->info[__pyx_cur_scope->__pyx_v_self->type]) & 0xF) != 0xF) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_4) {

      /* "pysam/cbcf.pyx":583
 *             idpair = h.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 yield idpair.key             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_cur_scope->__pyx_v_idpair->key); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __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_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* 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;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pysam/cbcf.pyx":575
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":585
 *                 yield 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_4cbcf_21VariantHeaderMetadata_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_9get[] = "VariantHeaderMetadata.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_9get(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_9get(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 585);

  /* "pysam/cbcf.pyx":587
 *     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_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/cbcf.pyx":588
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":589
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":590
 *             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;
    __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/cbcf.pyx":585
 *                 yield 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.cbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":592
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 592);

  /* "pysam/cbcf.pyx":593
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
 */
  {
    __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/cbcf.pyx":594
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    /*else:*/ {

      /* "pysam/cbcf.pyx":598
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
      __pyx_r = 1;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":595
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":596
 *             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;
    __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/cbcf.pyx":592
 *             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.cbcf.VariantHeaderMetadata.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":600
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_13iterkeys[] = "VariantHeaderMetadata.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 600);

  /* "pysam/cbcf.pyx":602
 *     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_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":600
 *             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.cbcf.VariantHeaderMetadata.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_17generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":604
 *         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_4cbcf_21VariantHeaderMetadata_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_15itervalues[] = "VariantHeaderMetadata.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_8_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_8_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 604);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_17generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantHeaderMetadata_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_17generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":606
 *     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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":607
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":604
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_20generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":609
 *             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_4cbcf_21VariantHeaderMetadata_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_18iteritems[] = "VariantHeaderMetadata.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_9_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_9_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 609);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_20generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantHeaderMetadata_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_21VariantHeaderMetadata_20generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":611
 *     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_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":612
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":609
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":614
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_21keys[] = "VariantHeaderMetadata.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_21keys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 614);

  /* "pysam/cbcf.pyx":616
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":614
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderMetadata.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":618
 *         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_4cbcf_21VariantHeaderMetadata_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_23items[] = "VariantHeaderMetadata.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_23items(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_23items(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 618);

  /* "pysam/cbcf.pyx":620
 *     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_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":618
 *         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.cbcf.VariantHeaderMetadata.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":622
 *         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_4cbcf_21VariantHeaderMetadata_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_25values[] = "VariantHeaderMetadata.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_25values(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_21VariantHeaderMetadata_25values(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 622);

  /* "pysam/cbcf.pyx":624
 *     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_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":622
 *         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.cbcf.VariantHeaderMetadata.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":632
 * 
 * 
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_f_5pysam_4cbcf_makeVariantHeaderMetadata(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, int32_t __pyx_v_type) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__pyx_v_meta = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeaderMetadata", 0);
  __Pyx_TraceCall("makeVariantHeaderMetadata", __pyx_f[0], 632);

  /* "pysam/cbcf.pyx":633
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":634
 * 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__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":636
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)             # <<<<<<<<<<<<<<
 *     meta.header = header
 *     meta.type = type
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantHeaderMetadata(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_meta = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":637
 * 
 *     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(__pyx_v_meta->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_meta->header));
  __pyx_v_meta->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":638
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)
 *     meta.header = header
 *     meta.type = type             # <<<<<<<<<<<<<<
 * 
 *     return meta
 */
  __pyx_v_meta->type = __pyx_v_type;

  /* "pysam/cbcf.pyx":640
 *     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/cbcf.pyx":632
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":648
 *     property name:
 *         """contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_CTG][self.id].key
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantContig_4name___get__(((struct __pyx_obj_5pysam_4cbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 648);

  /* "pysam/cbcf.pyx":649
 *         """contig name"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             return h.id[BCF_DT_CTG][self.id].key
 * 
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":650
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_CTG][self.id].key             # <<<<<<<<<<<<<<
 * 
 *     property id:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBytes_FromString(((__pyx_v_h->id[BCF_DT_CTG])[__pyx_v_self->id]).key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":648
 *     property name:
 *         """contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             return h.id[BCF_DT_CTG][self.id].key
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantContig.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":654
 *     property id:
 *         """contig internal id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantContig_2id___get__(((struct __pyx_obj_5pysam_4cbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 654);

  /* "pysam/cbcf.pyx":655
 *         """contig internal id number"""
 *         def __get__(self):
 *             return self.id             # <<<<<<<<<<<<<<
 * 
 *     property length:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":654
 *     property id:
 *         """contig internal id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.id
 * 
 */

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

/* "pysam/cbcf.pyx":659
 *     property length:
 *         """contig length or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef uint32_t length = h.id[BCF_DT_CTG][self.id].val.info[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_6length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_6length_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantContig_6length___get__(((struct __pyx_obj_5pysam_4cbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_6length___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  uint32_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 659);

  /* "pysam/cbcf.pyx":660
 *         """contig length or None if not available"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             cdef uint32_t length = h.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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":661
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef uint32_t length = h.id[BCF_DT_CTG][self.id].val.info[0]             # <<<<<<<<<<<<<<
 *             return length if length else None
 * 
 */
  __pyx_v_length = (((__pyx_v_h->id[BCF_DT_CTG])[__pyx_v_self->id]).val->info[0]);

  /* "pysam/cbcf.pyx":662
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef uint32_t length = h.id[BCF_DT_CTG][self.id].val.info[0]
 *             return length if length else None             # <<<<<<<<<<<<<<
 * 
 *     property header:
 */
  __Pyx_XDECREF(__pyx_r);
  if ((__pyx_v_length != 0)) {
    __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":659
 *     property length:
 *         """contig length or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef uint32_t length = h.id[BCF_DT_CTG][self.id].val.info[0]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantContig.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":666
 *     property header:
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_CTG][self.id].val.hrec[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantContig_6header_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantContig_6header___get__(((struct __pyx_obj_5pysam_4cbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantContig_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 666);

  /* "pysam/cbcf.pyx":667
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_CTG][self.id].val.hrec[0]
 *             return makeVariantHeaderRecord(self.header, hrec)
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":668
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_CTG][self.id].val.hrec[0]             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderRecord(self.header, hrec)
 * 
 */
  __pyx_v_hrec = (((__pyx_v_h->id[BCF_DT_CTG])[__pyx_v_self->id]).val->hrec[0]);

  /* "pysam/cbcf.pyx":669
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_CTG][self.id].val.hrec[0]
 *             return makeVariantHeaderRecord(self.header, hrec)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_2), __pyx_v_hrec)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":666
 *     property header:
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.header.ptr
 *             cdef bcf_hrec_t *hrec = h.id[BCF_DT_CTG][self.id].val.hrec[0]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantContig.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":672
 * 
 * 
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_f_5pysam_4cbcf_makeVariantContig(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, int __pyx_v_id) {
  struct __pyx_obj_5pysam_4cbcf_VariantContig *__pyx_v_contig = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantContig *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantContig", 0);
  __Pyx_TraceCall("makeVariantContig", __pyx_f[0], 672);

  /* "pysam/cbcf.pyx":673
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":674
 * 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__20, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":676
 *         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) != 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])) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":677
 * 
 *     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__21, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":679
 *         raise ValueError('invalid contig id')
 * 
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)             # <<<<<<<<<<<<<<
 *     contig.header = header
 *     contig.id = id
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantContig(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantContig)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantContig)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_contig = ((struct __pyx_obj_5pysam_4cbcf_VariantContig *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":680
 * 
 *     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(__pyx_v_contig->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_contig->header));
  __pyx_v_contig->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":681
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)
 *     contig.header = header
 *     contig.id = id             # <<<<<<<<<<<<<<
 * 
 *     return contig
 */
  __pyx_v_contig->id = __pyx_v_id;

  /* "pysam/cbcf.pyx":683
 *     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/cbcf.pyx":672
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":689
 *     """mapping from contig name or index to :class:`VariantContig` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs___len__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 689);

  /* "pysam/cbcf.pyx":690
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 *         return h.n[BCF_DT_CTG]
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":691
 *     def __len__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         return h.n[BCF_DT_CTG]
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((kh_size(((vdict_t *)(__pyx_v_h->dict[BCF_DT_CTG]))) == (__pyx_v_h->n[BCF_DT_CTG])) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "pysam/cbcf.pyx":692
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 *         return h.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = (__pyx_v_h->n[BCF_DT_CTG]);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":689
 *     """mapping from contig name or index to :class:`VariantContig` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":694
 *         return h.n[BCF_DT_CTG]
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 694);

  /* "pysam/cbcf.pyx":695
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 *         return h.n[BCF_DT_CTG] != 0
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":696
 *     def __bool__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         return h.n[BCF_DT_CTG] != 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((kh_size(((vdict_t *)(__pyx_v_h->dict[BCF_DT_CTG]))) == (__pyx_v_h->n[BCF_DT_CTG])) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "pysam/cbcf.pyx":697
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 *         return h.n[BCF_DT_CTG] != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = ((__pyx_v_h->n[BCF_DT_CTG]) != 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":694
 *         return h.n[BCF_DT_CTG]
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         assert kh_size(<vdict_t *>h.dict[BCF_DT_CTG]) == h.n[BCF_DT_CTG]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":699
 *         return h.n[BCF_DT_CTG] != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int index
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  int __pyx_v_index;
  vdict_t *__pyx_v_d;
  khiter_t __pyx_v_k;
  int __pyx_v_id;
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 699);

  /* "pysam/cbcf.pyx":700
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int index
 * 
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":703
 *         cdef int index
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= h.n[BCF_DT_CTG]:
 */
  __pyx_t_2 = PyInt_Check(__pyx_v_key); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":704
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 *             if index < 0 or index >= h.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
 */
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index = __pyx_t_4;

    /* "pysam/cbcf.pyx":705
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= h.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid contig index')
 *             return makeVariantContig(self.header, index)
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_index >= (__pyx_v_h->n[BCF_DT_CTG])) != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/cbcf.pyx":706
 *             index = key
 *             if index < 0 or index >= h.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__22, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":707
 *             if index < 0 or index >= h.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
 *             return makeVariantContig(self.header, index)             # <<<<<<<<<<<<<<
 * 
 *         cdef vdict_t *d = <vdict_t *>h.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_4cbcf_makeVariantContig(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_5), __pyx_v_index)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":709
 *             return makeVariantContig(self.header, index)
 * 
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 */
  __pyx_v_d = ((vdict_t *)(__pyx_v_h->dict[BCF_DT_CTG]));

  /* "pysam/cbcf.pyx":710
 * 
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]
 *         cdef khiter_t k = kh_get_vdict(d, key)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d):
 */
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_7);

  /* "pysam/cbcf.pyx":712
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid contig')
 * 
 */
  __pyx_t_3 = ((__pyx_v_k == kh_end(__pyx_v_d)) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":713
 * 
 *         if k == kh_end(d):
 *             raise KeyError('invalid contig')             # <<<<<<<<<<<<<<
 * 
 *         cdef int id = kh_val_vdict(d, k).id
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":715
 *             raise KeyError('invalid contig')
 * 
 *         cdef int id = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantContig(self.header, id)
 */
  __pyx_t_4 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_id = __pyx_t_4;

  /* "pysam/cbcf.pyx":717
 *         cdef int id = kh_val_vdict(d, k).id
 * 
 *         return makeVariantContig(self.header, id)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_5 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantContig(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_6), __pyx_v_id)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":699
 *         return h.n[BCF_DT_CTG] != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int index
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_8generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":719
 *         return makeVariantContig(self.header, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_10___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_10___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 719);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_8generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderContigs___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_8generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  uint32_t __pyx_t_2;
  uint32_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("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":720
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>h.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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":721
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         cdef uint32_t n = kh_size(d)
 * 
 */
  __pyx_cur_scope->__pyx_v_d = ((vdict_t *)(__pyx_cur_scope->__pyx_v_h->dict[BCF_DT_CTG]));

  /* "pysam/cbcf.pyx":722
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]
 *         cdef uint32_t n = kh_size(d)             # <<<<<<<<<<<<<<
 * 
 *         assert n == h.n[BCF_DT_CTG]
 */
  __pyx_cur_scope->__pyx_v_n = kh_size(__pyx_cur_scope->__pyx_v_d);

  /* "pysam/cbcf.pyx":724
 *         cdef uint32_t n = kh_size(d)
 * 
 *         assert n == h.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_cur_scope->__pyx_v_n == (__pyx_cur_scope->__pyx_v_h->n[BCF_DT_CTG])) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "pysam/cbcf.pyx":726
 *         assert n == h.n[BCF_DT_CTG]
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_hdr_id2name(h, i)
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":727
 * 
 *         for i in range(n):
 *             yield bcf_hdr_id2name(h, i)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_4 = __Pyx_PyBytes_FromString(bcf_hdr_id2name(__pyx_cur_scope->__pyx_v_h, __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __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_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":719
 *         return makeVariantContig(self.header, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_CTG]
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":729
 *             yield bcf_hdr_id2name(h, 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_4cbcf_20VariantHeaderContigs_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_9get[] = "VariantHeaderContigs.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_9get(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_9get(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 729);

  /* "pysam/cbcf.pyx":731
 *     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_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/cbcf.pyx":732
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":733
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":734
 *             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;
    __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/cbcf.pyx":729
 *             yield bcf_hdr_id2name(h, 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.cbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":736
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 736);

  /* "pysam/cbcf.pyx":737
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
 */
  {
    __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/cbcf.pyx":738
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    /*else:*/ {

      /* "pysam/cbcf.pyx":742
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
      __pyx_r = 1;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":739
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":740
 *             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;
    __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/cbcf.pyx":736
 *             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.cbcf.VariantHeaderContigs.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":744
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_13iterkeys[] = "VariantHeaderContigs.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 744);

  /* "pysam/cbcf.pyx":746
 *     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_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":744
 *             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.cbcf.VariantHeaderContigs.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":748
 *         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_4cbcf_20VariantHeaderContigs_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_15itervalues[] = "VariantHeaderContigs.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_11_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_11_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 748);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_17generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantHeaderContigs_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":750
 *     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_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":751
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":748
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":753
 *             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_4cbcf_20VariantHeaderContigs_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_18iteritems[] = "VariantHeaderContigs.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_12_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_12_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 753);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_20generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantHeaderContigs_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderContigs_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":755
 *     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_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":756
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":753
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":758
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_21keys[] = "VariantHeaderContigs.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_21keys(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 758);

  /* "pysam/cbcf.pyx":760
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":758
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderContigs.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":762
 *         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_4cbcf_20VariantHeaderContigs_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_23items[] = "VariantHeaderContigs.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_23items(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_23items(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 762);

  /* "pysam/cbcf.pyx":764
 *     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_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":762
 *         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.cbcf.VariantHeaderContigs.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":766
 *         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_4cbcf_20VariantHeaderContigs_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_25values[] = "VariantHeaderContigs.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_25values(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderContigs_25values(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 766);

  /* "pysam/cbcf.pyx":768
 *     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_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":766
 *         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.cbcf.VariantHeaderContigs.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":776
 * 
 * 
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_f_5pysam_4cbcf_makeVariantHeaderContigs(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__pyx_v_contigs = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeaderContigs", 0);
  __Pyx_TraceCall("makeVariantHeaderContigs", __pyx_f[0], 776);

  /* "pysam/cbcf.pyx":777
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":778
 * 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__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":780
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderContigs contigs = VariantHeaderContigs.__new__(VariantHeaderContigs)             # <<<<<<<<<<<<<<
 *     contigs.header = header
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantHeaderContigs(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeaderContigs)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantHeaderContigs)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_contigs = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":781
 * 
 *     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(__pyx_v_contigs->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_contigs->header));
  __pyx_v_contigs->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":783
 *     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/cbcf.pyx":776
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":789
 *     """sequence of sample names from a :class:`VariantHeader` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples___len__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples___len__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 789);

  /* "pysam/cbcf.pyx":790
 * 
 *     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/cbcf.pyx":789
 *     """sequence of sample names from a :class:`VariantHeader` object"""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
 */

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

/* "pysam/cbcf.pyx":792
 *         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_4cbcf_20VariantHeaderSamples_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 792);

  /* "pysam/cbcf.pyx":793
 * 
 *     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/cbcf.pyx":792
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
 */

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

/* "pysam/cbcf.pyx":795
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_index) {
  bcf_hdr_t *__pyx_v_h;
  int32_t __pyx_v_n;
  int32_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 795);

  /* "pysam/cbcf.pyx":796
 * 
 *     def __getitem__(self, index):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 *         cdef int32_t i = index
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":797
 *     def __getitem__(self, index):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 *         cdef int32_t i = index
 * 
 */
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":798
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 *         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_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_2;

  /* "pysam/cbcf.pyx":800
 *         cdef int32_t i = index
 * 
 *         if i < 0 or i >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
 */
  __pyx_t_4 = ((__pyx_v_i < 0) != 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) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":801
 * 
 *         if i < 0 or i >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return h.samples[i]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":803
 *             raise IndexError('invalid sample index')
 * 
 *         return h.samples[i]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBytes_FromString((__pyx_v_h->samples[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":795
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderSamples.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderSamples_8generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":805
 *         return h.samples[i]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_13___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_13___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 805);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantHeaderSamples_8generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantHeaderSamples___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderSamples.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantHeaderSamples_8generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_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("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":806
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 *         cdef int32_t i
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":807
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 *         cdef int32_t i
 * 
 */
  __pyx_cur_scope->__pyx_v_n = bcf_hdr_nsamples(__pyx_cur_scope->__pyx_v_h);

  /* "pysam/cbcf.pyx":810
 *         cdef int32_t i
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield h.samples[i]
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":811
 * 
 *         for i in range(n):
 *             yield h.samples[i]             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
    __pyx_t_4 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_v_h->samples[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __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_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":805
 *         return h.samples[i]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(h)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":813
 *             yield h.samples[i]
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_SAMPLE]
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_10__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_10__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_9__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_20VariantHeaderSamples_9__contains__(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  vdict_t *__pyx_v_d;
  khiter_t __pyx_v_k;
  int __pyx_r;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 813);

  /* "pysam/cbcf.pyx":814
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_SAMPLE]
 *         cdef khiter_t k = kh_get_vdict(d, key)
 */
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":815
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_SAMPLE]             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 */
  __pyx_v_d = ((vdict_t *)(__pyx_v_h->dict[BCF_DT_SAMPLE]));

  /* "pysam/cbcf.pyx":816
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_SAMPLE]
 *         cdef khiter_t k = kh_get_vdict(d, key)             # <<<<<<<<<<<<<<
 * 
 *         return k != kh_end(d)
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/cbcf.pyx":818
 *         cdef khiter_t k = kh_get_vdict(d, key)
 * 
 *         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/cbcf.pyx":813
 *             yield h.samples[i]
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>h.dict[BCF_DT_SAMPLE]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeaderSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":826
 * 
 * 
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_f_5pysam_4cbcf_makeVariantHeaderSamples(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__pyx_v_samples = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeaderSamples", 0);
  __Pyx_TraceCall("makeVariantHeaderSamples", __pyx_f[0], 826);

  /* "pysam/cbcf.pyx":827
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":828
 * 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__26, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":830
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderSamples samples = VariantHeaderSamples.__new__(VariantHeaderSamples)             # <<<<<<<<<<<<<<
 *     samples.header = header
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantHeaderSamples(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeaderSamples)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantHeaderSamples)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_samples = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":831
 * 
 *     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(__pyx_v_samples->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_samples->header));
  __pyx_v_samples->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":833
 *     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/cbcf.pyx":826
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":844
 * 
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self, mode):             # <<<<<<<<<<<<<<
 *         self.ptr = NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mode,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_mode = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader___cinit__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self), __pyx_v_mode);

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

static int __pyx_pf_5pysam_4cbcf_13VariantHeader___cinit__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_mode) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 844);

  /* "pysam/cbcf.pyx":845
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self, mode):
 *         self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     # Python constructor
 */
  __pyx_v_self->ptr = NULL;

  /* "pysam/cbcf.pyx":844
 * 
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self, mode):             # <<<<<<<<<<<<<<
 *         self.ptr = NULL
 * 
 */

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

/* "pysam/cbcf.pyx":848
 * 
 *     # Python constructor
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         if mode not in 'rw':
 *             raise ValueError("invalid header mode specified '{}'".format(mode))
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mode,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_mode = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantHeader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_2__init__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self), __pyx_v_mode);

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

static int __pyx_pf_5pysam_4cbcf_13VariantHeader_2__init__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_mode) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char const *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 848);
  __Pyx_INCREF(__pyx_v_mode);

  /* "pysam/cbcf.pyx":849
 *     # Python constructor
 *     def __init__(self, mode):
 *         if mode not in 'rw':             # <<<<<<<<<<<<<<
 *             raise ValueError("invalid header mode specified '{}'".format(mode))
 * 
 */
  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_mode, __pyx_n_s_rw, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":850
 *     def __init__(self, mode):
 *         if mode not in 'rw':
 *             raise ValueError("invalid header mode specified '{}'".format(mode))             # <<<<<<<<<<<<<<
 * 
 *         mode = force_bytes(mode)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_invalid_header_mode_specified, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":852
 *             raise ValueError("invalid header mode specified '{}'".format(mode))
 * 
 *         mode = force_bytes(mode)             # <<<<<<<<<<<<<<
 *         self.ptr = bcf_hdr_init(mode)
 * 
 */
  __pyx_t_3 = __pyx_f_5pysam_4cbcf_force_bytes(__pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":853
 * 
 *         mode = force_bytes(mode)
 *         self.ptr = bcf_hdr_init(mode)             # <<<<<<<<<<<<<<
 * 
 *         if not self.ptr:
 */
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->ptr = bcf_hdr_init(__pyx_t_7);

  /* "pysam/cbcf.pyx":855
 *         self.ptr = bcf_hdr_init(mode)
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot create VariantHeader')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ptr != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":856
 * 
 *         if not self.ptr:
 *             raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":848
 * 
 *     # Python constructor
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         if mode not in 'rw':
 *             raise ValueError("invalid header mode specified '{}'".format(mode))
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantHeader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":858
 *             raise ValueError('cannot create VariantHeader')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
 */

/* Python wrapper */
static void __pyx_pw_5pysam_4cbcf_13VariantHeader_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_13VariantHeader_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_13VariantHeader_4__dealloc__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_13VariantHeader_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 858);

  /* "pysam/cbcf.pyx":859
 * 
 *     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/cbcf.pyx":860
 *     def __dealloc__(self):
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    bcf_hdr_destroy(__pyx_v_self->ptr);

    /* "pysam/cbcf.pyx":861
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
    __pyx_v_self->ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":858
 *             raise ValueError('cannot create VariantHeader')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
 */

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

/* "pysam/cbcf.pyx":863
 *             self.ptr = NULL
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         # self.ptr == NULL should be impossible
 *         return self.ptr != NULL
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_7__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_13VariantHeader_7__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_6__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_13VariantHeader_6__bool__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 863);

  /* "pysam/cbcf.pyx":865
 *     def __bool__(self):
 *         # self.ptr == NULL should be impossible
 *         return self.ptr != NULL             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __pyx_r = (__pyx_v_self->ptr != NULL);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":863
 *             self.ptr = NULL
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         # self.ptr == NULL should be impossible
 *         return self.ptr != NULL
 */

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

/* "pysam/cbcf.pyx":867
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_13VariantHeader_8copy[] = "VariantHeader.copy(self)";
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_8copy(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_8copy(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_TraceCall("copy", __pyx_f[0], 867);

  /* "pysam/cbcf.pyx":868
 * 
 *     def copy(self):
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))             # <<<<<<<<<<<<<<
 * 
 *     property version:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeader(bcf_hdr_dup(__pyx_v_self->ptr))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "pysam/cbcf.pyx":872
 *     property version:
 *         """VCF version"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_get_version(self.ptr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7version___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7version___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 872);

  /* "pysam/cbcf.pyx":873
 *         """VCF version"""
 *         def __get__(self):
 *             return bcf_hdr_get_version(self.ptr)             # <<<<<<<<<<<<<<
 * 
 *     property samples:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(bcf_hdr_get_version(__pyx_v_self->ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":872
 *     property version:
 *         """VCF version"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_get_version(self.ptr)
 * 
 */

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

/* "pysam/cbcf.pyx":877
 *     property samples:
 *         """samples (:class:`VariantHeaderSamples`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderSamples(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7samples_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7samples___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 877);

  /* "pysam/cbcf.pyx":878
 *         """samples (:class:`VariantHeaderSamples`)"""
 *         def __get__(self):
 *             return makeVariantHeaderSamples(self)             # <<<<<<<<<<<<<<
 * 
 *     property records:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderSamples(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":877
 *     property samples:
 *         """samples (:class:`VariantHeaderSamples`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderSamples(self)
 * 
 */

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

/* "pysam/cbcf.pyx":882
 *     property records:
 *         """header records (:class:`VariantHeaderRecords`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderRecords(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7records_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7records_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7records___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7records___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 882);

  /* "pysam/cbcf.pyx":883
 *         """header records (:class:`VariantHeaderRecords`)"""
 *         def __get__(self):
 *             return makeVariantHeaderRecords(self)             # <<<<<<<<<<<<<<
 * 
 *     property contigs:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderRecords(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":882
 *     property records:
 *         """header records (:class:`VariantHeaderRecords`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderRecords(self)
 * 
 */

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

/* "pysam/cbcf.pyx":887
 *     property contigs:
 *         """contig information (:class:`VariantHeaderContigs`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderContigs(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7contigs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7contigs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7contigs___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7contigs___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 887);

  /* "pysam/cbcf.pyx":888
 *         """contig information (:class:`VariantHeaderContigs`)"""
 *         def __get__(self):
 *             return makeVariantHeaderContigs(self)             # <<<<<<<<<<<<<<
 * 
 *     property filters:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderContigs(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":887
 *     property contigs:
 *         """contig information (:class:`VariantHeaderContigs`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderContigs(self)
 * 
 */

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

/* "pysam/cbcf.pyx":892
 *     property filters:
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_FLT)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7filters_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7filters_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7filters___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7filters___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 892);

  /* "pysam/cbcf.pyx":893
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):
 *             return makeVariantHeaderMetadata(self, BCF_HL_FLT)             # <<<<<<<<<<<<<<
 * 
 *     property info:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_FLT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":892
 *     property filters:
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_FLT)
 * 
 */

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

/* "pysam/cbcf.pyx":897
 *     property info:
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_INFO)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_4info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_4info___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_4info___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 897);

  /* "pysam/cbcf.pyx":898
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):
 *             return makeVariantHeaderMetadata(self, BCF_HL_INFO)             # <<<<<<<<<<<<<<
 * 
 *     property formats:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_INFO)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":897
 *     property info:
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_INFO)
 * 
 */

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

/* "pysam/cbcf.pyx":902
 *     property formats:
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_FMT)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7formats_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_7formats_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_7formats___get__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_7formats___get__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 902);

  /* "pysam/cbcf.pyx":903
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):
 *             return makeVariantHeaderMetadata(self, BCF_HL_FMT)             # <<<<<<<<<<<<<<
 * 
 *     # only safe to do when opening an htsfile
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_FMT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":902
 *     property formats:
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return makeVariantHeaderMetadata(self, BCF_HL_FMT)
 * 
 */

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

/* "pysam/cbcf.pyx":906
 * 
 *     # 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_4cbcf_13VariantHeader__subset_samples(struct __pyx_obj_5pysam_4cbcf_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_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;
  PyObject *__pyx_t_7 = NULL;
  char *__pyx_t_8;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("_subset_samples", 0);
  __Pyx_TraceCall("_subset_samples", __pyx_f[0], 906);
  __Pyx_INCREF(__pyx_v_include_samples);

  /* "pysam/cbcf.pyx":907
 *     # 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_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":908
 *     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_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_include_samples, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":909
 *         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_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_missing_samples = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":910
 *         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_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_keep_samples, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":912
 *         keep_samples   &= include_samples
 * 
 *         if missing_samples:             # <<<<<<<<<<<<<<
 *             # FIXME: add specialized exception with payload
 *             raise ValueError('missing {:d} requested samples'.format(len(missing_samples)))
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_missing_samples); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":914
 *         if missing_samples:
 *             # FIXME: add specialized exception with payload
 *             raise ValueError('missing {:d} requested samples'.format(len(missing_samples)))             # <<<<<<<<<<<<<<
 * 
 *         keep_samples = ','.join(keep_samples)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_missing_d_requested_samples, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Length(__pyx_v_missing_samples); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":916
 *             raise ValueError('missing {:d} requested samples'.format(len(missing_samples)))
 * 
 *         keep_samples = ','.join(keep_samples)             # <<<<<<<<<<<<<<
 *         cdef char *keep = <char *>keep_samples if keep_samples else NULL
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)
 */
  __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__9, __pyx_v_keep_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_keep_samples, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":917
 * 
 *         keep_samples = ','.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_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_keep_samples); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((char *)__pyx_t_9);
  } else {
    __pyx_t_8 = NULL;
  }
  __pyx_v_keep = __pyx_t_8;

  /* "pysam/cbcf.pyx":918
 *         keep_samples = ','.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_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":920
 *         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_2 = PyObject_RichCompare(__pyx_v_ret, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":921
 * 
 *         if ret != 0:
 *             raise ValueError('bcf_hdr_set_samples failed: ret = {}'.format(ret))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_bcf_hdr_set_samples_failed_ret, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_ret);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ret);
      __Pyx_GIVEREF(__pyx_v_ret);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":906
 * 
 *     # 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":923
 *             raise ValueError('bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int hlen
 *         cdef char *hstr = bcf_hdr_fmt_text(self.ptr, 0, &hlen)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantHeader_11__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantHeader_10__str__(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantHeader_10__str__(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_self) {
  int __pyx_v_hlen;
  char *__pyx_v_hstr;
  CYTHON_UNUSED PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);
  __Pyx_TraceCall("__str__", __pyx_f[0], 923);

  /* "pysam/cbcf.pyx":925
 *     def __str__(self):
 *         cdef int hlen
 *         cdef char *hstr = bcf_hdr_fmt_text(self.ptr, 0, &hlen)             # <<<<<<<<<<<<<<
 * 
 *         ret = hstr[:hlen]
 */
  __pyx_v_hstr = bcf_hdr_fmt_text(__pyx_v_self->ptr, 0, (&__pyx_v_hlen));

  /* "pysam/cbcf.pyx":927
 *         cdef char *hstr = bcf_hdr_fmt_text(self.ptr, 0, &hlen)
 * 
 *         ret = hstr[:hlen]             # <<<<<<<<<<<<<<
 *         free(hstr)
 *         return force_str(hstr)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_hstr + 0, __pyx_v_hlen - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":928
 * 
 *         ret = hstr[:hlen]
 *         free(hstr)             # <<<<<<<<<<<<<<
 *         return force_str(hstr)
 * 
 */
  free(__pyx_v_hstr);

  /* "pysam/cbcf.pyx":929
 *         ret = hstr[:hlen]
 *         free(hstr)
 *         return force_str(hstr)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_hstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_5pysam_4cbcf_force_str(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":923
 *             raise ValueError('bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int hlen
 *         cdef char *hstr = bcf_hdr_fmt_text(self.ptr, 0, &hlen)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":932
 * 
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *h):             # <<<<<<<<<<<<<<
 *     if not h:
 *         raise ValueError('cannot create VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_f_5pysam_4cbcf_makeVariantHeader(bcf_hdr_t *__pyx_v_h) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantHeader", 0);
  __Pyx_TraceCall("makeVariantHeader", __pyx_f[0], 932);

  /* "pysam/cbcf.pyx":933
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *h):
 *     if not h:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantHeader')
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_h != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":934
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *h):
 *     if not h:
 *         raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader, None)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":936
 *         raise ValueError('cannot create VariantHeader')
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader, None)             # <<<<<<<<<<<<<<
 *     header.ptr = h
 * 
 */
  __pyx_t_2 = __pyx_tp_new_5pysam_4cbcf_VariantHeader(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantHeader)), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5pysam_4cbcf_VariantHeader)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":937
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader, None)
 *     header.ptr = h             # <<<<<<<<<<<<<<
 * 
 *     return header
 */
  __pyx_v_header->ptr = __pyx_v_h;

  /* "pysam/cbcf.pyx":939
 *     header.ptr = h
 * 
 *     return header             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_header));
  __pyx_r = __pyx_v_header;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":932
 * 
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *h):             # <<<<<<<<<<<<<<
 *     if not h:
 *         raise ValueError('cannot create VariantHeader')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":950
 *     """mapping from filter index or name to :class:`VariantMetadata` object for filters set on a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter___len__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordFilter___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 950);

  /* "pysam/cbcf.pyx":951
 * 
 *     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/cbcf.pyx":950
 *     """mapping from filter index or name to :class:`VariantMetadata` object for filters set on a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt
 * 
 */

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

/* "pysam/cbcf.pyx":953
 *         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_4cbcf_19VariantRecordFilter_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 953);

  /* "pysam/cbcf.pyx":954
 * 
 *     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/cbcf.pyx":953
 *         return self.record.ptr.d.n_flt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt != 0
 * 
 */

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

/* "pysam/cbcf.pyx":956
 *         return self.record.ptr.d.n_flt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  int __pyx_v_index;
  int __pyx_v_id;
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __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;
  char *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 956);
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/cbcf.pyx":957
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = 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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":958
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = 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/cbcf.pyx":960
 *         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/cbcf.pyx":962
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "pysam/cbcf.pyx":963
 * 
 *         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_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index = __pyx_t_3;

    /* "pysam/cbcf.pyx":965
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
 */
    __pyx_t_4 = ((__pyx_v_index < 0) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_5 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_index >= __pyx_v_n) != 0);
    __pyx_t_5 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/cbcf.pyx":966
 * 
 *             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__30, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":968
 *                 raise IndexError('invalid filter index')
 * 
 *             id = r.d.flt[index]             # <<<<<<<<<<<<<<
 *         else:
 *             if key == '.':
 */
    __pyx_v_id = (__pyx_v_r->d.flt[__pyx_v_index]);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":970
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_kp_s__14, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pysam/cbcf.pyx":971
 *         else:
 *             if key == '.':
 *                 key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *             id = bcf_hdr_id2int(h, BCF_DT_ID, key)
 */
      __Pyx_INCREF(__pyx_n_s_PASS);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_n_s_PASS);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pysam/cbcf.pyx":973
 *                 key = 'PASS'
 * 
 *             id = bcf_hdr_id2int(h, BCF_DT_ID, key)             # <<<<<<<<<<<<<<
 * 
 *             if not bcf_hdr_idinfo_exists(h, BCF_HL_FLT, id) or not bcf_has_filter(h, self.record.ptr, key):
 */
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_id = bcf_hdr_id2int(__pyx_v_h, BCF_DT_ID, __pyx_t_7);

    /* "pysam/cbcf.pyx":975
 *             id = bcf_hdr_id2int(h, BCF_DT_ID, key)
 * 
 *             if not bcf_hdr_idinfo_exists(h, BCF_HL_FLT, id) or not bcf_has_filter(h, self.record.ptr, key):             # <<<<<<<<<<<<<<
 *                 raise KeyError('Invalid filter')
 * 
 */
    __pyx_t_4 = ((!(bcf_hdr_idinfo_exists(__pyx_v_h, BCF_HL_FLT, __pyx_v_id) != 0)) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_5 = __pyx_t_4;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((!(bcf_has_filter(__pyx_v_h, __pyx_v_self->record->ptr, __pyx_t_8) != 0)) != 0);
    __pyx_t_5 = __pyx_t_4;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/cbcf.pyx":976
 * 
 *             if not bcf_hdr_idinfo_exists(h, BCF_HL_FLT, id) or not bcf_has_filter(h, self.record.ptr, key):
 *                 raise KeyError('Invalid filter')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":978
 *                 raise KeyError('Invalid filter')
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_9 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_6), BCF_HL_FLT, __pyx_v_id)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":956
 *         return self.record.ptr.d.n_flt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_9);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_8generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":980
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_14___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_14___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 980);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFilter_8generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordFilter___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_8generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":981
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.d.n_flt
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":982
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = r.d.n_flt
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":983
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.d.n_flt             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->d.n_flt;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":985
 *         cdef int i, n = r.d.n_flt
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.flt[i])
 * 
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":986
 * 
 *         for i in range(n):
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.flt[i])             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_5 = __Pyx_PyBytes_FromString(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_h, BCF_DT_ID, (__pyx_cur_scope->__pyx_v_r->d.flt[__pyx_cur_scope->__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __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_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":980
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":988
 *             yield bcf_hdr_int2id(h, 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_4cbcf_19VariantRecordFilter_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_9get[] = "VariantRecordFilter.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_9get(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 988);

  /* "pysam/cbcf.pyx":990
 *     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_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/cbcf.pyx":991
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":992
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":993
 *             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;
    __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/cbcf.pyx":988
 *             yield bcf_hdr_int2id(h, 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.cbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":995
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  char *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 995);

  /* "pysam/cbcf.pyx":996
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         return bcf_has_filter(h, r, key) == 1
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":997
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         return bcf_has_filter(h, r, key) == 1
 * 
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":998
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         return bcf_has_filter(h, r, key) == 1             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = (bcf_has_filter(__pyx_v_h, __pyx_v_r, __pyx_t_3) == 1);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":995
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1000
 *         return bcf_has_filter(h, r, key) == 1
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_13iterkeys[] = "VariantRecordFilter.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1000);

  /* "pysam/cbcf.pyx":1002
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1000
 *         return bcf_has_filter(h, r, key) == 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.cbcf.VariantRecordFilter.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_17generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1004
 *         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_4cbcf_19VariantRecordFilter_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_15itervalues[] = "VariantRecordFilter.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_15_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_15_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1004);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFilter_17generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordFilter_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_17generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1006
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1007
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1004
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_20generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1009
 *             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_4cbcf_19VariantRecordFilter_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_18iteritems[] = "VariantRecordFilter.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_16_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_16_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1009);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFilter_20generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordFilter_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFilter_20generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1011
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1012
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1009
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1014
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_21keys[] = "VariantRecordFilter.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1014);

  /* "pysam/cbcf.pyx":1016
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1014
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFilter.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1018
 *         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_4cbcf_19VariantRecordFilter_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_23items[] = "VariantRecordFilter.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_23items(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1018);

  /* "pysam/cbcf.pyx":1020
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1018
 *         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.cbcf.VariantRecordFilter.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1022
 *         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_4cbcf_19VariantRecordFilter_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_25values[] = "VariantRecordFilter.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFilter_25values(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFilter_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1022);

  /* "pysam/cbcf.pyx":1024
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1022
 *         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.cbcf.VariantRecordFilter.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_f_5pysam_4cbcf_makeVariantRecordFilter(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__pyx_v_filter = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecordFilter", 0);
  __Pyx_TraceCall("makeVariantRecordFilter", __pyx_f[0], 1032);

  /* "pysam/cbcf.pyx":1033
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1034
 * 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__32, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1036
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)             # <<<<<<<<<<<<<<
 *     filter.record = record
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantRecordFilter(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecordFilter)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantRecordFilter)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_filter = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1037
 * 
 *     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(__pyx_v_filter->record);
  __Pyx_DECREF(((PyObject *)__pyx_v_filter->record));
  __pyx_v_filter->record = __pyx_v_record;

  /* "pysam/cbcf.pyx":1039
 *     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/cbcf.pyx":1032
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1045
 *     """mapping from format name or index to :class:`VariantMetadata` object for formats present in a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat___len__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordFormat___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1045);

  /* "pysam/cbcf.pyx":1046
 * 
 *     def __len__(self):
 *         return self.record.ptr.n_fmt             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->record->ptr->n_fmt;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1045
 *     """mapping from format name or index to :class:`VariantMetadata` object for formats present in a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt
 * 
 */

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

/* "pysam/cbcf.pyx":1048
 *         return self.record.ptr.n_fmt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1048);

  /* "pysam/cbcf.pyx":1049
 * 
 *     def __bool__(self):
 *         return self.record.ptr.n_fmt != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = (__pyx_v_self->record->ptr->n_fmt != 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1048
 *         return self.record.ptr.n_fmt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt != 0
 * 
 */

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

/* "pysam/cbcf.pyx":1051
 *         return self.record.ptr.n_fmt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_v_index;
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1051);

  /* "pysam/cbcf.pyx":1052
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = 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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1053
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef int index
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1056
 *         cdef bcf_fmt_t *fmt
 *         cdef int index
 *         cdef int n = r.n_fmt             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(key, int):
 */
  __pyx_t_3 = __pyx_v_r->n_fmt;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":1058
 *         cdef int n = r.n_fmt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= n:
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_key); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "pysam/cbcf.pyx":1059
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid format index')
 */
    __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index = __pyx_t_6;

    /* "pysam/cbcf.pyx":1060
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid format index')
 *             fmt = &r.d.fmt[index]
 */
    __pyx_t_4 = ((__pyx_v_index < 0) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_5 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_index >= __pyx_v_n) != 0);
    __pyx_t_5 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/cbcf.pyx":1061
 *             index = key
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid format index')             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[index]
 *         else:
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":1062
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid format index')
 *             fmt = &r.d.fmt[index]             # <<<<<<<<<<<<<<
 *         else:
 *             fmt = bcf_get_fmt(h, r, key)
 */
    __pyx_v_fmt = (&(__pyx_v_r->d.fmt[__pyx_v_index]));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1064
 *             fmt = &r.d.fmt[index]
 *         else:
 *             fmt = bcf_get_fmt(h, r, key)             # <<<<<<<<<<<<<<
 *             if not fmt:
 *                 raise KeyError('unknown format')
 */
    __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fmt = bcf_get_fmt(__pyx_v_h, __pyx_v_r, __pyx_t_8);

    /* "pysam/cbcf.pyx":1065
 *         else:
 *             fmt = bcf_get_fmt(h, r, key)
 *             if not fmt:             # <<<<<<<<<<<<<<
 *                 raise KeyError('unknown format')
 * 
 */
    __pyx_t_5 = ((!(__pyx_v_fmt != 0)) != 0);
    if (__pyx_t_5) {

      /* "pysam/cbcf.pyx":1066
 *             fmt = bcf_get_fmt(h, r, key)
 *             if not fmt:
 *                 raise KeyError('unknown format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1068
 *                 raise KeyError('unknown format')
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_9 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_7), BCF_HL_FMT, __pyx_v_fmt->id)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1051
 *         return self.record.ptr.n_fmt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_8generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1070
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___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_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_17___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_17___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1070);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFormat_8generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordFormat___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_8generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1071
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_fmt
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1072
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = r.n_fmt
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1073
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_fmt             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_fmt;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":1075
 *         cdef int i, n = r.n_fmt
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].id)
 * 
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1076
 * 
 *         for i in range(n):
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].id)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_6 = __Pyx_PyBytes_FromString(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_h, BCF_DT_ID, (__pyx_cur_scope->__pyx_v_r->d.fmt[__pyx_cur_scope->__pyx_v_i]).id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __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_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1070
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1078
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].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_4cbcf_19VariantRecordFormat_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_9get[] = "VariantRecordFormat.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_9get(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 1078);

  /* "pysam/cbcf.pyx":1080
 *     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_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/cbcf.pyx":1081
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1082
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1083
 *             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;
    __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/cbcf.pyx":1078
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].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.cbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1085
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  char const *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1085);

  /* "pysam/cbcf.pyx":1086
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1087
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 *         return fmt != NULL
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1088
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)             # <<<<<<<<<<<<<<
 *         return fmt != NULL
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_h, __pyx_v_r, __pyx_t_3);

  /* "pysam/cbcf.pyx":1089
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 *         return fmt != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __pyx_r = (__pyx_v_fmt != NULL);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1085
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1091
 *         return fmt != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_13iterkeys[] = "VariantRecordFormat.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1091);

  /* "pysam/cbcf.pyx":1093
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1091
 *         return fmt != 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.cbcf.VariantRecordFormat.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_17generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1095
 *         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_4cbcf_19VariantRecordFormat_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_15itervalues[] = "VariantRecordFormat.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_18_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_18_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1095);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFormat_17generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordFormat_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_17generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1097
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1098
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1095
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_20generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1100
 *             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_4cbcf_19VariantRecordFormat_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_18iteritems[] = "VariantRecordFormat.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_19_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_19_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1100);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordFormat_20generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordFormat_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordFormat_20generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1102
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1103
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1100
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1105
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_21keys[] = "VariantRecordFormat.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1105);

  /* "pysam/cbcf.pyx":1107
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1105
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordFormat.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1109
 *         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_4cbcf_19VariantRecordFormat_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_23items[] = "VariantRecordFormat.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_23items(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1109);

  /* "pysam/cbcf.pyx":1111
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1109
 *         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.cbcf.VariantRecordFormat.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1113
 *         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_4cbcf_19VariantRecordFormat_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_25values[] = "VariantRecordFormat.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordFormat_25values(((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordFormat_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1113);

  /* "pysam/cbcf.pyx":1115
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1113
 *         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.cbcf.VariantRecordFormat.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_f_5pysam_4cbcf_makeVariantRecordFormat(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__pyx_v_format = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecordFormat", 0);
  __Pyx_TraceCall("makeVariantRecordFormat", __pyx_f[0], 1123);

  /* "pysam/cbcf.pyx":1124
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1125
 * 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__35, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1127
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)             # <<<<<<<<<<<<<<
 *     format.record = record
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantRecordFormat(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecordFormat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantRecordFormat)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_format = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1128
 * 
 *     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(__pyx_v_format->record);
  __Pyx_DECREF(((PyObject *)__pyx_v_format->record));
  __pyx_v_format->record = __pyx_v_record;

  /* "pysam/cbcf.pyx":1130
 *     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/cbcf.pyx":1123
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1137
 *     """mapping from info metadata name to value for info data present in a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_info
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo___len__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_17VariantRecordInfo___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1137);

  /* "pysam/cbcf.pyx":1138
 * 
 *     def __len__(self):
 *         return self.record.ptr.n_info             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->record->ptr->n_info;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1137
 *     """mapping from info metadata name to value for info data present in a :class:`VariantRecord` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_info
 * 
 */

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

/* "pysam/cbcf.pyx":1140
 *         return self.record.ptr.n_info
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_info != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1140);

  /* "pysam/cbcf.pyx":1141
 * 
 *     def __bool__(self):
 *         return self.record.ptr.n_info != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = (__pyx_v_self->record->ptr->n_info != 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1140
 *         return self.record.ptr.n_info
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_info != 0
 * 
 */

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

/* "pysam/cbcf.pyx":1143
 *         return self.record.ptr.n_info != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_info_t *__pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  char const *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1143);

  /* "pysam/cbcf.pyx":1144
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1145
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 * 
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1146
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)             # <<<<<<<<<<<<<<
 * 
 *         if not info:
 */
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_info = bcf_get_info(__pyx_v_h, __pyx_v_r, __pyx_t_3);

  /* "pysam/cbcf.pyx":1148
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 * 
 *         if not info:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_info != 0)) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1149
 * 
 *         if not info:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return bcf_info_value(info)
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unknown_INFO_field, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_key); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1151
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         return bcf_info_value(info)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_5pysam_4cbcf_bcf_info_value(__pyx_v_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1143
 *         return self.record.ptr.n_info != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_8generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1153
 *         return bcf_info_value(info)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_20___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_20___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1153);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_17VariantRecordInfo_8generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordInfo___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_8generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1154
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_info
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1155
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = r.n_info
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1156
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_info             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":1158
 *         cdef int i, n = r.n_info
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.info[i].key)
 * 
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1159
 * 
 *         for i in range(n):
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.info[i].key)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_6 = __Pyx_PyBytes_FromString(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_h, BCF_DT_ID, (__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]).key)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __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_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1153
 *         return bcf_info_value(info)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1161
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.info[i].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_4cbcf_17VariantRecordInfo_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_9get[] = "VariantRecordInfo.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_9get(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 1161);

  /* "pysam/cbcf.pyx":1163
 *     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_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/cbcf.pyx":1164
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1165
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1166
 *             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;
    __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/cbcf.pyx":1161
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.info[i].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.cbcf.VariantRecordInfo.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1168
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_info_t *__pyx_v_info;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  char const *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1168);

  /* "pysam/cbcf.pyx":1169
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1170
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 * 
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1171
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)             # <<<<<<<<<<<<<<
 * 
 *         return info != NULL
 */
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_info = bcf_get_info(__pyx_v_h, __pyx_v_r, __pyx_t_3);

  /* "pysam/cbcf.pyx":1173
 *         cdef bcf_info_t *info = bcf_get_info(h, r, key)
 * 
 *         return info != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __pyx_r = (__pyx_v_info != NULL);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1168
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1175
 *         return info != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_13iterkeys[] = "VariantRecordInfo.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1175);

  /* "pysam/cbcf.pyx":1177
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1175
 *         return info != 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.cbcf.VariantRecordInfo.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_17generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1179
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_15itervalues[] = "VariantRecordInfo.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_21_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_21_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1179);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_17VariantRecordInfo_17generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordInfo_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_17generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf1_t *__pyx_t_1;
  uint32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1181
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef int i, n = r.n_info
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/cbcf.pyx":1183
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
 *         cdef int i, n = r.n_info             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_2;

  /* "pysam/cbcf.pyx":1185
 *         cdef int i, n = r.n_info
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             yield bcf_info_value(info)
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1186
 * 
 *         for i in range(n):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             yield bcf_info_value(info)
 * 
 */
    __pyx_cur_scope->__pyx_v_info = (&(__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/cbcf.pyx":1187
 *         for i in range(n):
 *             info = &r.d.info[i]
 *             yield bcf_info_value(info)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_5 = __pyx_f_5pysam_4cbcf_bcf_info_value(__pyx_cur_scope->__pyx_v_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __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_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1179
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_20generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1189
 *             yield bcf_info_value(info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_18iteritems[] = "VariantRecordInfo.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_22_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_22_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1189);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_17VariantRecordInfo_20generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordInfo_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_17VariantRecordInfo_20generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1191
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = 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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1192
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef int i, n = r.n_info
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1194
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
 *         cdef int i, n = r.n_info             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":1196
 *         cdef int i, n = r.n_info
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(h, BCF_DT_ID, info.key)
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1197
 * 
 *         for i in range(n):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             key = bcf_hdr_int2id(h, BCF_DT_ID, info.key)
 *             value = bcf_info_value(info)
 */
    __pyx_cur_scope->__pyx_v_info = (&(__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/cbcf.pyx":1198
 *         for i in range(n):
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(h, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *             value = bcf_info_value(info)
 *             yield key, value
 */
    __pyx_cur_scope->__pyx_v_key = bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_h, BCF_DT_ID, __pyx_cur_scope->__pyx_v_info->key);

    /* "pysam/cbcf.pyx":1199
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(h, BCF_DT_ID, info.key)
 *             value = bcf_info_value(info)             # <<<<<<<<<<<<<<
 *             yield key, value
 * 
 */
    __pyx_t_6 = __pyx_f_5pysam_4cbcf_bcf_info_value(__pyx_cur_scope->__pyx_v_info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/cbcf.pyx":1200
 *             key = bcf_hdr_int2id(h, BCF_DT_ID, info.key)
 *             value = bcf_info_value(info)
 *             yield key, value             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_cur_scope->__pyx_v_value);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
    __pyx_t_6 = 0;
    __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_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1189
 *             yield bcf_info_value(info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1202
 *             yield key, value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_21keys[] = "VariantRecordInfo.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1202);

  /* "pysam/cbcf.pyx":1204
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1202
 *             yield 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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordInfo.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1206
 *         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_4cbcf_17VariantRecordInfo_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_23items[] = "VariantRecordInfo.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_23items(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1206);

  /* "pysam/cbcf.pyx":1208
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1206
 *         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.cbcf.VariantRecordInfo.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1210
 *         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_4cbcf_17VariantRecordInfo_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_25values[] = "VariantRecordInfo.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_17VariantRecordInfo_25values(((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_17VariantRecordInfo_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1210);

  /* "pysam/cbcf.pyx":1212
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1210
 *         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.cbcf.VariantRecordInfo.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_f_5pysam_4cbcf_makeVariantRecordInfo(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__pyx_v_info = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecordInfo", 0);
  __Pyx_TraceCall("makeVariantRecordInfo", __pyx_f[0], 1220);

  /* "pysam/cbcf.pyx":1221
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1222
 * 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__36, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1224
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)             # <<<<<<<<<<<<<<
 *     info.record = record
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantRecordInfo(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecordInfo)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantRecordInfo)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_info = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1225
 * 
 *     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(__pyx_v_info->record);
  __Pyx_DECREF(((PyObject *)__pyx_v_info->record));
  __pyx_v_info->record = __pyx_v_record;

  /* "pysam/cbcf.pyx":1227
 *     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/cbcf.pyx":1220
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1233
 *     """mapping from sample index or name to :class:`makeVariantRecordSample` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.record.header.ptr)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples___len__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_20VariantRecordSamples___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1233);

  /* "pysam/cbcf.pyx":1234
 * 
 *     def __len__(self):
 *         return bcf_hdr_nsamples(self.record.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = bcf_hdr_nsamples(__pyx_v_self->record->header->ptr);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1233
 *     """mapping from sample index or name to :class:`makeVariantRecordSample` object."""
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.record.header.ptr)
 * 
 */

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

/* "pysam/cbcf.pyx":1236
 *         return bcf_hdr_nsamples(self.record.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1236);

  /* "pysam/cbcf.pyx":1237
 * 
 *     def __bool__(self):
 *         return bcf_hdr_nsamples(self.record.header.ptr) != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = (bcf_hdr_nsamples(__pyx_v_self->record->header->ptr) != 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1236
 *         return bcf_hdr_nsamples(self.record.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 */

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

/* "pysam/cbcf.pyx":1239
 *         return bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  CYTHON_UNUSED bcf1_t *__pyx_v_r;
  int __pyx_v_n;
  int __pyx_v_sample_index;
  PyObject *__pyx_r = NULL;
  __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;
  char const *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1239);

  /* "pysam/cbcf.pyx":1240
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1241
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int n = bcf_hdr_nsamples(h)
 *         cdef int sample_index
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1242
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 *         cdef int sample_index
 *         cdef vdict_t *d
 */
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":1247
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
  __pyx_t_3 = PyInt_Check(__pyx_v_key); 
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1248
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sample_index = __pyx_t_5;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1250
 *             sample_index = key
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)             # <<<<<<<<<<<<<<
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')
 */
    __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_h, BCF_DT_SAMPLE, __pyx_t_6);

    /* "pysam/cbcf.pyx":1251
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name')
 * 
 */
    __pyx_t_4 = ((__pyx_v_sample_index < 0) != 0);
    if (__pyx_t_4) {

      /* "pysam/cbcf.pyx":1252
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')             # <<<<<<<<<<<<<<
 * 
 *         if sample_index < 0 or sample_index >= n:
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1254
 *                 raise KeyError('invalid sample name')
 * 
 *         if sample_index < 0 or sample_index >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
 */
  __pyx_t_3 = ((__pyx_v_sample_index < 0) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_sample_index >= __pyx_v_n) != 0);
  __pyx_t_4 = __pyx_t_3;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1255
 * 
 *         if sample_index < 0 or sample_index >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecordSample(self.record, sample_index)
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1257
 *             raise IndexError('invalid sample index')
 * 
 *         return makeVariantRecordSample(self.record, sample_index)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_t_7), __pyx_v_sample_index)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __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;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1239
 *         return bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_8generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1259
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_23___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_23___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1259);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantRecordSamples_8generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordSamples___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_8generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  bcf1_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("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1260
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1261
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1262
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_cur_scope->__pyx_v_n = bcf_hdr_nsamples(__pyx_cur_scope->__pyx_v_h);

  /* "pysam/cbcf.pyx":1264
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield h.samples[i]
 * 
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1265
 * 
 *         for i in range(n):
 *             yield h.samples[i]             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_5 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_v_h->samples[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __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_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1259
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1267
 *             yield h.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_4cbcf_20VariantRecordSamples_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_9get[] = "VariantRecordSamples.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_9get(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 1267);

  /* "pysam/cbcf.pyx":1269
 *     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_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/cbcf.pyx":1270
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1271
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1272
 *             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;
    __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/cbcf.pyx":1267
 *             yield h.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.cbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1274
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  CYTHON_UNUSED bcf1_t *__pyx_v_r;
  int __pyx_v_n;
  int __pyx_v_sample_index;
  int __pyx_r;
  __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;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1274);

  /* "pysam/cbcf.pyx":1275
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1276
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int n = bcf_hdr_nsamples(h)
 *         cdef int sample_index
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1277
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 *         cdef int sample_index
 *         cdef vdict_t *d
 */
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":1282
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
 */
  __pyx_t_3 = PyInt_Check(__pyx_v_key); 
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1283
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sample_index = __pyx_t_5;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1285
 *             sample_index = key
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)             # <<<<<<<<<<<<<<
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')
 */
    __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_h, BCF_DT_SAMPLE, __pyx_t_6);

    /* "pysam/cbcf.pyx":1286
 *         else:
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name')
 * 
 */
    __pyx_t_4 = ((__pyx_v_sample_index < 0) != 0);
    if (__pyx_t_4) {

      /* "pysam/cbcf.pyx":1287
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')             # <<<<<<<<<<<<<<
 * 
 *         return 0 <= sample_index < n
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1289
 *                 raise KeyError('invalid sample name')
 * 
 *         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/cbcf.pyx":1274
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1291
 *         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_4cbcf_20VariantRecordSamples_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_13iterkeys[] = "VariantRecordSamples.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1291);

  /* "pysam/cbcf.pyx":1293
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1291
 *         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.cbcf.VariantRecordSamples.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_17generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1295
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_15itervalues[] = "VariantRecordSamples.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_24_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_24_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1295);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantRecordSamples_17generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordSamples_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_17generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1297
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1298
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1299
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_cur_scope->__pyx_v_n = bcf_hdr_nsamples(__pyx_cur_scope->__pyx_v_h);

  /* "pysam/cbcf.pyx":1301
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield makeVariantRecordSample(self.record, i)
 * 
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1302
 * 
 *         for i in range(n):
 *             yield makeVariantRecordSample(self.record, i)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_t_5), __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __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;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1295
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_20generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1304
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_18iteritems[] = "VariantRecordSamples.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_25_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_25_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1304);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_20VariantRecordSamples_20generator19, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordSamples_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_20VariantRecordSamples_20generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1306
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1307
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1308
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_cur_scope->__pyx_v_n = bcf_hdr_nsamples(__pyx_cur_scope->__pyx_v_h);

  /* "pysam/cbcf.pyx":1310
 *         cdef int32_t i, n = bcf_hdr_nsamples(h)
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield h.samples[i], makeVariantRecordSample(self.record, i)
 * 
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1311
 * 
 *         for i in range(n):
 *             yield h.samples[i], makeVariantRecordSample(self.record, i)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
    __pyx_t_5 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_v_h->samples[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_t_6), __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __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_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1304
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1313
 *             yield h.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_4cbcf_20VariantRecordSamples_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_21keys[] = "VariantRecordSamples.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1313);

  /* "pysam/cbcf.pyx":1315
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1313
 *             yield h.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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSamples.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1317
 *         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_4cbcf_20VariantRecordSamples_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_23items[] = "VariantRecordSamples.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_23items(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1317);

  /* "pysam/cbcf.pyx":1319
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1317
 *         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.cbcf.VariantRecordSamples.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1321
 *         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_4cbcf_20VariantRecordSamples_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_25values[] = "VariantRecordSamples.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_20VariantRecordSamples_25values(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_20VariantRecordSamples_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1321);

  /* "pysam/cbcf.pyx":1323
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1321
 *         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.cbcf.VariantRecordSamples.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_f_5pysam_4cbcf_makeVariantRecordSamples(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__pyx_v_genos = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecordSamples", 0);
  __Pyx_TraceCall("makeVariantRecordSamples", __pyx_f[0], 1331);

  /* "pysam/cbcf.pyx":1332
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1333
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSamples genos = VariantRecordSamples.__new__(VariantRecordSamples)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1335
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordSamples genos = VariantRecordSamples.__new__(VariantRecordSamples)             # <<<<<<<<<<<<<<
 *     genos.record = record
 * 
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantRecordSamples(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecordSamples)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantRecordSamples)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_genos = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1336
 * 
 *     cdef VariantRecordSamples genos = VariantRecordSamples.__new__(VariantRecordSamples)
 *     genos.record = record             # <<<<<<<<<<<<<<
 * 
 *     return genos
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_record));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_record));
  __Pyx_GOTREF(__pyx_v_genos->record);
  __Pyx_DECREF(((PyObject *)__pyx_v_genos->record));
  __pyx_v_genos->record = __pyx_v_record;

  /* "pysam/cbcf.pyx":1338
 *     genos.record = record
 * 
 *     return genos             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_genos));
  __pyx_r = __pyx_v_genos;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1331
 * 
 * 
 * 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.cbcf.makeVariantRecordSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_genos);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1344
 *     """Variant record"""
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 */

/* Python wrapper */
static void __pyx_pw_5pysam_4cbcf_13VariantRecord_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_13VariantRecord_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_13VariantRecord___dealloc__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_13VariantRecord___dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1344);

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

    /* "pysam/cbcf.pyx":1347
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     property rid:
 */
    __pyx_v_self->ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1344
 *     """Variant record"""
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 */

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

/* "pysam/cbcf.pyx":1351
 *     property rid:
 *         """internal reference id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.rid
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3rid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3rid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_3rid___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3rid___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1351);

  /* "pysam/cbcf.pyx":1352
 *         """internal reference id number"""
 *         def __get__(self):
 *             return self.ptr.rid             # <<<<<<<<<<<<<<
 * 
 *     property chrom:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->ptr->rid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1351
 *     property rid:
 *         """internal reference id number"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.rid
 * 
 */

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

/* "pysam/cbcf.pyx":1356
 *     property chrom:
 *         """chromosome/contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_5chrom_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_5chrom_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_5chrom___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_5chrom___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1356);

  /* "pysam/cbcf.pyx":1357
 *         """chromosome/contig name"""
 *         def __get__(self):
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)             # <<<<<<<<<<<<<<
 * 
 *     property contig:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(bcf_hdr_id2name(__pyx_v_self->header->ptr, __pyx_v_self->ptr->rid)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1356
 *     property chrom:
 *         """chromosome/contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)
 * 
 */

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

/* "pysam/cbcf.pyx":1361
 *     property contig:
 *         """chromosome/contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6contig_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6contig_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_6contig___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6contig___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1361);

  /* "pysam/cbcf.pyx":1362
 *         """chromosome/contig name"""
 *         def __get__(self):
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)             # <<<<<<<<<<<<<<
 * 
 *     property pos:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(bcf_hdr_id2name(__pyx_v_self->header->ptr, __pyx_v_self->ptr->rid)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1361
 *     property contig:
 *         """chromosome/contig name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2name(self.header.ptr, self.ptr.rid)
 * 
 */

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

/* "pysam/cbcf.pyx":1366
 *     property pos:
 *         """record start position on chrom/contig (1-based inclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos + 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3pos_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_3pos___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3pos___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1366);

  /* "pysam/cbcf.pyx":1367
 *         """record start position on chrom/contig (1-based inclusive)"""
 *         def __get__(self):
 *             return self.ptr.pos + 1             # <<<<<<<<<<<<<<
 * 
 *     property start:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->ptr->pos + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1366
 *     property pos:
 *         """record start position on chrom/contig (1-based inclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos + 1
 * 
 */

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

/* "pysam/cbcf.pyx":1371
 *     property start:
 *         """record start position on chrom/contig (0-based inclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_5start_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_5start_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_5start___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_5start___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1371);

  /* "pysam/cbcf.pyx":1372
 *         """record start position on chrom/contig (0-based inclusive)"""
 *         def __get__(self):
 *             return self.ptr.pos             # <<<<<<<<<<<<<<
 * 
 *     property stop:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->ptr->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1371
 *     property start:
 *         """record start position on chrom/contig (0-based inclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos
 * 
 */

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

/* "pysam/cbcf.pyx":1376
 *     property stop:
 *         """record stop position on chrom/contig (0-based exclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos + self.ptr.rlen
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4stop_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4stop_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_4stop___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4stop___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1376);

  /* "pysam/cbcf.pyx":1377
 *         """record stop position on chrom/contig (0-based exclusive)"""
 *         def __get__(self):
 *             return self.ptr.pos + self.ptr.rlen             # <<<<<<<<<<<<<<
 * 
 *     property rlen:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->ptr->pos + __pyx_v_self->ptr->rlen)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1376
 *     property stop:
 *         """record stop position on chrom/contig (0-based exclusive)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.pos + self.ptr.rlen
 * 
 */

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

/* "pysam/cbcf.pyx":1381
 *     property rlen:
 *         """record length on chrom/contig (rec.stop - rec.start)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.rlen
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4rlen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4rlen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_4rlen___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4rlen___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1381);

  /* "pysam/cbcf.pyx":1382
 *         """record length on chrom/contig (rec.stop - rec.start)"""
 *         def __get__(self):
 *             return self.ptr.rlen             # <<<<<<<<<<<<<<
 * 
 *     property qual:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->ptr->rlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1381
 *     property rlen:
 *         """record length on chrom/contig (rec.stop - rec.start)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.rlen
 * 
 */

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

/* "pysam/cbcf.pyx":1386
 *     property qual:
 *         """phred scaled quality score or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4qual_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_4qual___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4qual___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1386);

  /* "pysam/cbcf.pyx":1387
 *         """phred scaled quality score or None if not available"""
 *         def __get__(self):
 *             return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None             # <<<<<<<<<<<<<<
 * 
 * #   property n_info:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((!(bcf_float_is_missing(__pyx_v_self->ptr->qual) != 0)) != 0)) {
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->ptr->qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1386
 *     property qual:
 *         """phred scaled quality score or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None
 * 
 */

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

/* "pysam/cbcf.pyx":1423
 *     property id:
 *         """record identifier or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_2id___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_2id___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  char *__pyx_v_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1423);

  /* "pysam/cbcf.pyx":1424
 *         """record identifier or None if not available"""
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Error unpacking VariantRecord')
 *             id = self.ptr.d.id
 */
  __pyx_t_1 = ((bcf_unpack(__pyx_v_self->ptr, BCF_UN_STR) < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1425
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             id = self.ptr.d.id
 *             return id if id != b'.' else None
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1426
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             id = self.ptr.d.id             # <<<<<<<<<<<<<<
 *             return id if id != b'.' else None
 * 
 */
  __pyx_t_3 = __pyx_v_self->ptr->d.id;
  __pyx_v_id = __pyx_t_3;

  /* "pysam/cbcf.pyx":1427
 *                 raise ValueError('Error unpacking VariantRecord')
 *             id = self.ptr.d.id
 *             return id if id != b'.' else None             # <<<<<<<<<<<<<<
 * 
 *     property ref:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_kp_b__14, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1423
 *     property id:
 *         """record identifier or None if not available"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1431
 *     property ref:
 *         """reference allele"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3ref_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_3ref___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_3ref___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1431);

  /* "pysam/cbcf.pyx":1432
 *         """reference allele"""
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return self.ptr.d.allele[0] if self.ptr.d.allele else None
 */
  __pyx_t_1 = ((bcf_unpack(__pyx_v_self->ptr, BCF_UN_STR) < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1433
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return self.ptr.d.allele[0] if self.ptr.d.allele else None
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1434
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return self.ptr.d.allele[0] if self.ptr.d.allele else None             # <<<<<<<<<<<<<<
 * 
 *     property alleles:
 */
  __Pyx_XDECREF(__pyx_r);
  if ((__pyx_v_self->ptr->d.allele != 0)) {
    __pyx_t_3 = __Pyx_PyBytes_FromString((__pyx_v_self->ptr->d.allele[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1431
 *     property ref:
 *         """reference allele"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1438
 *     property alleles:
 *         """tuple of reference allele followed by alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_7alleles_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_7alleles_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_13VariantRecord_7alleles_7__get___2generator28(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1443
 *             if not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property alts:
 */

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles_7__get___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_27_genexpr(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_27_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 1443);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_13VariantRecord_7alleles_7__get___2generator28, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantRecord___get___locals_gen); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.alleles.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_13VariantRecord_7alleles_7__get___2generator28(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  uint32_t __pyx_t_1;
  uint32_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->ptr->n_allele;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_3 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->ptr->d.allele[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1438
 *     property alleles:
 *         """tuple of reference allele followed by alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_26___get__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_26___get__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1438);
  __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/cbcf.pyx":1439
 *         """tuple of reference allele followed by alt alleles"""
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if not self.ptr.d.allele:
 */
  __pyx_t_1 = ((bcf_unpack(__pyx_cur_scope->__pyx_v_self->ptr, BCF_UN_STR) < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1440
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             if not self.ptr.d.allele:
 *                 return None
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1441
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if not self.ptr.d.allele:             # <<<<<<<<<<<<<<
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(self.ptr.n_allele))
 */
  __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->ptr->d.allele != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1442
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if not self.ptr.d.allele:
 *                 return None             # <<<<<<<<<<<<<<
 *             return tuple(self.ptr.d.allele[i] for i in range(self.ptr.n_allele))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1443
 *             if not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property alts:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_pf_5pysam_4cbcf_13VariantRecord_7alleles_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1438
 *     property alleles:
 *         """tuple of reference allele followed by alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.alleles.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1447
 *     property alts:
 *         """tuple of alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4alts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4alts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_4alts___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_13VariantRecord_4alts_7__get___2generator29(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1452
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(1,self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property filter:
 */

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4alts_7__get___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_29_genexpr(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_29_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_TraceCall("genexpr", __pyx_f[0], 1452);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_13VariantRecord_4alts_7__get___2generator29, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_VariantRecord___get___locals_gen); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.alts.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_13VariantRecord_4alts_7__get___2generator29(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  uint32_t __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->ptr->n_allele;
  for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_3 = __Pyx_PyBytes_FromString((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->ptr->d.allele[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1447
 *     property alts:
 *         """tuple of alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4alts___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_28___get__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_28___get__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1447);
  __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/cbcf.pyx":1448
 *         """tuple of alt alleles"""
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 */
  __pyx_t_1 = ((bcf_unpack(__pyx_cur_scope->__pyx_v_self->ptr, BCF_UN_STR) < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1449
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1450
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:             # <<<<<<<<<<<<<<
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(1,self.ptr.n_allele))
 */
  __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_self->ptr->n_allele < 2) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_self->ptr->d.allele != 0)) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1451
 *                 raise ValueError('Error unpacking VariantRecord')
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None             # <<<<<<<<<<<<<<
 *             return tuple(self.ptr.d.allele[i] for i in range(1,self.ptr.n_allele))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1452
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None
 *             return tuple(self.ptr.d.allele[i] for i in range(1,self.ptr.n_allele))             # <<<<<<<<<<<<<<
 * 
 *     property filter:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_pf_5pysam_4cbcf_13VariantRecord_4alts_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1447
 *     property alts:
 *         """tuple of alt alleles"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecord.alts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1456
 *     property filter:
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6filter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6filter_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_6filter___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6filter___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1456);

  /* "pysam/cbcf.pyx":1457
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         def __get__(self):
 *             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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1458
 *         def __get__(self):
 *             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__45, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1459
 *             if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return makeVariantRecordFilter(self)             # <<<<<<<<<<<<<<
 * 
 *     property info:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordFilter(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1456
 *     property filter:
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

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

/* "pysam/cbcf.pyx":1463
 *     property info:
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_4info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_4info___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_4info___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1463);

  /* "pysam/cbcf.pyx":1464
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         def __get__(self):
 *             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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1465
 *         def __get__(self):
 *             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__46, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1466
 *             if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return makeVariantRecordInfo(self)             # <<<<<<<<<<<<<<
 * 
 *     property format:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordInfo(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1463
 *     property info:
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

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

/* "pysam/cbcf.pyx":1470
 *     property format:
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_6format_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_6format___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_6format___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1470);

  /* "pysam/cbcf.pyx":1471
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         def __get__(self):
 *             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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1472
 *         def __get__(self):
 *             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__47, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1473
 *             if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return makeVariantRecordFormat(self)             # <<<<<<<<<<<<<<
 * 
 *     property samples:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordFormat(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1470
 *     property format:
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

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

/* "pysam/cbcf.pyx":1477
 *     property samples:
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_7samples_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_7samples___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_7samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1477);

  /* "pysam/cbcf.pyx":1478
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return makeVariantRecordSamples(self)
 */
  __pyx_t_1 = ((bcf_unpack(__pyx_v_self->ptr, BCF_UN_IND) < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1479
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return makeVariantRecordSamples(self)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1480
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 *             return makeVariantRecordSamples(self)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecordSamples(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1477
 *     property samples:
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')
 */

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

/* "pysam/cbcf.pyx":1482
 *             return makeVariantRecordSamples(self)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef kstring_t line
 *         cdef char c
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13VariantRecord_3__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13VariantRecord_2__str__(((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13VariantRecord_2__str__(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_self) {
  kstring_t __pyx_v_line;
  PyObject *__pyx_v_ret = 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_TraceDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);
  __Pyx_TraceCall("__str__", __pyx_f[0], 1482);

  /* "pysam/cbcf.pyx":1486
 *         cdef char c
 * 
 *         line.l = line.m = 0             # <<<<<<<<<<<<<<
 *         line.s = NULL
 * 
 */
  __pyx_v_line.l = 0;
  __pyx_v_line.m = 0;

  /* "pysam/cbcf.pyx":1487
 * 
 *         line.l = line.m = 0
 *         line.s = NULL             # <<<<<<<<<<<<<<
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
 */
  __pyx_v_line.s = NULL;

  /* "pysam/cbcf.pyx":1489
 *         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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1490
 * 
 *         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/cbcf.pyx":1491
 *         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);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pysam/cbcf.pyx":1492
 *             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__49, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1501
 *         #    line.l -= 1
 * 
 *         ret = line.s[:line.l]             # <<<<<<<<<<<<<<
 *         ret = force_str(ret)
 * 
 */
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_line.s + 0, __pyx_v_line.l - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":1502
 * 
 *         ret = line.s[:line.l]
 *         ret = force_str(ret)             # <<<<<<<<<<<<<<
 * 
 *         if line.m:
 */
  __pyx_t_2 = __pyx_f_5pysam_4cbcf_force_str(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":1504
 *         ret = force_str(ret)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 * 
 */
  __pyx_t_1 = (__pyx_v_line.m != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1505
 * 
 *         if line.m:
 *             free(line.s)             # <<<<<<<<<<<<<<
 * 
 *         return ret
 */
    free(__pyx_v_line.s);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysam/cbcf.pyx":1507
 *             free(line.s)
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1482
 *             return makeVariantRecordSamples(self)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef kstring_t line
 *         cdef char c
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1510
 * 
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
 */

static struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_f_5pysam_4cbcf_makeVariantRecord(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, bcf1_t *__pyx_v_r) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecord", 0);
  __Pyx_TraceCall("makeVariantRecord", __pyx_f[0], 1510);

  /* "pysam/cbcf.pyx":1511
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1512
 * 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__50, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1514
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not r:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecord')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_r != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1515
 * 
 *     if not r:
 *         raise ValueError('cannot create VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1517
 *         raise ValueError('cannot create VariantRecord')
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)             # <<<<<<<<<<<<<<
 *     record.header = header
 *     record.ptr = r
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_VariantRecord(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecord)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_VariantRecord)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1518
 * 
 *     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(__pyx_v_record->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_record->header));
  __pyx_v_record->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":1519
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 *     record.header = header
 *     record.ptr = r             # <<<<<<<<<<<<<<
 * 
 *     return record
 */
  __pyx_v_record->ptr = __pyx_v_r;

  /* "pysam/cbcf.pyx":1521
 *     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/cbcf.pyx":1510
 * 
 * 
 * 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_AddTraceback("pysam.cbcf.makeVariantRecord", __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1537
 *     property name:
 *         """sample name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_4name___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_4name___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  CYTHON_UNUSED bcf1_t *__pyx_v_r;
  int32_t __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1537);

  /* "pysam/cbcf.pyx":1538
 *         """sample name"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1539
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 * 
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1540
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 * 
 *             if self.index < 0 or self.index >= n:
 */
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":1542
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 * 
 *             if self.index < 0 or self.index >= n:             # <<<<<<<<<<<<<<
 *                 raise ValueError('invalid sample index')
 * 
 */
  __pyx_t_4 = ((__pyx_v_self->index < 0) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_self->index >= __pyx_v_n) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1543
 * 
 *             if self.index < 0 or self.index >= n:
 *                 raise ValueError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *             return h.samples[self.index]
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1545
 *                 raise ValueError('invalid sample index')
 * 
 *             return h.samples[self.index]             # <<<<<<<<<<<<<<
 * 
 *     property allele_indices:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBytes_FromString((__pyx_v_h->samples[__pyx_v_self->index])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1537
 *     property name:
 *         """sample name"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1549
 *     property allele_indices:
 *         """allele indices for called genotype, if present.  Otherwise None"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_14allele_indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_14allele_indices_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_14allele_indices___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_14allele_indices___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  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;
  PyObject *__pyx_v_alleles = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  bcf_fmt_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1549);

  /* "pysam/cbcf.pyx":1550
 *         """allele indices for called genotype, if present.  Otherwise None"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1551
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 * 
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1552
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t n = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 * 
 *             if self.index < 0 or self.index >= n or not r.n_fmt:
 */
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":1554
 *             cdef int32_t n = bcf_hdr_nsamples(h)
 * 
 *             if self.index < 0 or self.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
  __pyx_t_4 = ((__pyx_v_self->index < 0) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_self->index >= __pyx_v_n) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_r->n_fmt != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1555
 * 
 *             if self.index < 0 or self.index >= n or not r.n_fmt:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1557
 *                 return None
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *             cdef int gt0 = is_gt_fmt(h, fmt0)
 * 
 */
  __pyx_t_5 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_5;

  /* "pysam/cbcf.pyx":1558
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt
 *             cdef int gt0 = is_gt_fmt(h, fmt0)             # <<<<<<<<<<<<<<
 * 
 *             if not gt0 or not fmt0.n:
 */
  __pyx_v_gt0 = __pyx_f_5pysam_4cbcf_is_gt_fmt(__pyx_v_h, __pyx_v_fmt0);

  /* "pysam/cbcf.pyx":1560
 *             cdef int gt0 = is_gt_fmt(h, fmt0)
 * 
 *             if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_gt0 != 0)) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_fmt0->n != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1561
 * 
 *             if not gt0 or not fmt0.n:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             cdef int8_t  *data8
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1566
 *             cdef int16_t *data16
 *             cdef int32_t *data32
 *             alleles = []             # <<<<<<<<<<<<<<
 * 
 *             if fmt0.type == BCF_BT_INT8:
 */
  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_alleles = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pysam/cbcf.pyx":1568
 *             alleles = []
 * 
 *             if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_3 = ((__pyx_v_fmt0->type == BCF_BT_INT8) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1569
 * 
 *             if fmt0.type == BCF_BT_INT8:
 *                 data8 = <int8_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1570
 *             if fmt0.type == BCF_BT_INT8:
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break
 */
    __pyx_t_7 = __pyx_v_fmt0->n;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "pysam/cbcf.pyx":1571
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     alleles.append( (data8[i] >> 1) - 1 )
 */
      __pyx_t_3 = (((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end) != 0);
      if (__pyx_t_3) {

        /* "pysam/cbcf.pyx":1572
 *                 for i in range(fmt0.n):
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     alleles.append( (data8[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT16:
 */
        goto __pyx_L12_break;
      }

      /* "pysam/cbcf.pyx":1573
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break
 *                     alleles.append( (data8[i] >> 1) - 1 )             # <<<<<<<<<<<<<<
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 */
      __pyx_t_6 = __Pyx_PyInt_From_long((((__pyx_v_data8[__pyx_v_i]) >> 1) - 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L12_break:;
    goto __pyx_L10;
  }

  /* "pysam/cbcf.pyx":1574
 *                         break
 *                     alleles.append( (data8[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_3 = ((__pyx_v_fmt0->type == BCF_BT_INT16) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1575
 *                     alleles.append( (data8[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1576
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break
 */
    __pyx_t_7 = __pyx_v_fmt0->n;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "pysam/cbcf.pyx":1577
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     alleles.append( (data16[i] >> 1) - 1 )
 */
      __pyx_t_3 = (((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end) != 0);
      if (__pyx_t_3) {

        /* "pysam/cbcf.pyx":1578
 *                 for i in range(fmt0.n):
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     alleles.append( (data16[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT32:
 */
        goto __pyx_L15_break;
      }

      /* "pysam/cbcf.pyx":1579
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break
 *                     alleles.append( (data16[i] >> 1) - 1 )             # <<<<<<<<<<<<<<
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 */
      __pyx_t_6 = __Pyx_PyInt_From_long((((__pyx_v_data16[__pyx_v_i]) >> 1) - 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L15_break:;
    goto __pyx_L10;
  }

  /* "pysam/cbcf.pyx":1580
 *                         break
 *                     alleles.append( (data16[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_3 = ((__pyx_v_fmt0->type == BCF_BT_INT32) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1581
 *                     alleles.append( (data16[i] >> 1) - 1 )
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1582
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break
 */
    __pyx_t_7 = __pyx_v_fmt0->n;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "pysam/cbcf.pyx":1583
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     alleles.append( (data32[i] >> 1) - 1 )
 */
      __pyx_t_3 = (((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end) != 0);
      if (__pyx_t_3) {

        /* "pysam/cbcf.pyx":1584
 *                 for i in range(fmt0.n):
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     alleles.append( (data32[i] >> 1) - 1 )
 * 
 */
        goto __pyx_L18_break;
      }

      /* "pysam/cbcf.pyx":1585
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break
 *                     alleles.append( (data32[i] >> 1) - 1 )             # <<<<<<<<<<<<<<
 * 
 *             return tuple(alleles)
 */
      __pyx_t_6 = __Pyx_PyInt_From_long((((__pyx_v_data32[__pyx_v_i]) >> 1) - 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L18_break:;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "pysam/cbcf.pyx":1587
 *                     alleles.append( (data32[i] >> 1) - 1 )
 * 
 *             return tuple(alleles)             # <<<<<<<<<<<<<<
 * 
 *     property alleles:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyList_AsTuple(__pyx_v_alleles); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1549
 *     property allele_indices:
 *         """allele indices for called genotype, if present.  Otherwise None"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.allele_indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alleles);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1591
 *     property alleles:
 *         """alleles for called genotype, if present.  Otherwise None"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_7alleles_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_7alleles_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_7alleles___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_7alleles___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_h;
  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_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;
  bcf_fmt_t *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1591);

  /* "pysam/cbcf.pyx":1592
 *         """alleles for called genotype, if present.  Otherwise None"""
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t nsamples = bcf_hdr_nsamples(h)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1593
 *         def __get__(self):
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *             cdef int32_t nsamples = bcf_hdr_nsamples(h)
 *             cdef int32_t nalleles = r.n_allele
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1594
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t nsamples = bcf_hdr_nsamples(h)             # <<<<<<<<<<<<<<
 *             cdef int32_t nalleles = r.n_allele
 * 
 */
  __pyx_v_nsamples = bcf_hdr_nsamples(__pyx_v_h);

  /* "pysam/cbcf.pyx":1595
 *             cdef bcf1_t *r = self.record.ptr
 *             cdef int32_t nsamples = bcf_hdr_nsamples(h)
 *             cdef int32_t nalleles = r.n_allele             # <<<<<<<<<<<<<<
 * 
 *             if self.index < 0 or self.index >= nsamples or not r.n_fmt:
 */
  __pyx_t_3 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_3;

  /* "pysam/cbcf.pyx":1597
 *             cdef int32_t nalleles = r.n_allele
 * 
 *             if self.index < 0 or self.index >= nsamples or not r.n_fmt:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->index < 0) != 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_nsamples) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = ((!(__pyx_v_r->n_fmt != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1598
 * 
 *             if self.index < 0 or self.index >= nsamples or not r.n_fmt:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1600
 *                 return None
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *             cdef int gt0 = is_gt_fmt(h, fmt0)
 * 
 */
  __pyx_t_6 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_6;

  /* "pysam/cbcf.pyx":1601
 * 
 *             cdef bcf_fmt_t *fmt0 = r.d.fmt
 *             cdef int gt0 = is_gt_fmt(h, fmt0)             # <<<<<<<<<<<<<<
 * 
 *             if not gt0 or not fmt0.n:
 */
  __pyx_v_gt0 = __pyx_f_5pysam_4cbcf_is_gt_fmt(__pyx_v_h, __pyx_v_fmt0);

  /* "pysam/cbcf.pyx":1603
 *             cdef int gt0 = is_gt_fmt(h, fmt0)
 * 
 *             if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
  __pyx_t_5 = ((!(__pyx_v_gt0 != 0)) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = ((!(__pyx_v_fmt0->n != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1604
 * 
 *             if not gt0 or not fmt0.n:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             cdef int32_t  a
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1610
 *             cdef int16_t *data16
 *             cdef int32_t *data32
 *             alleles = []             # <<<<<<<<<<<<<<
 * 
 *             if fmt0.type == BCF_BT_INT8:
 */
  __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_alleles = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pysam/cbcf.pyx":1612
 *             alleles = []
 * 
 *             if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_4 = ((__pyx_v_fmt0->type == BCF_BT_INT8) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1613
 * 
 *             if fmt0.type == BCF_BT_INT8:
 *                 data8 = <int8_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1614
 *             if fmt0.type == BCF_BT_INT8:
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break
 */
    __pyx_t_8 = __pyx_v_fmt0->n;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/cbcf.pyx":1615
 *                 data8 = <int8_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     a = (data8[i] >> 1) - 1
 */
      __pyx_t_4 = (((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end) != 0);
      if (__pyx_t_4) {

        /* "pysam/cbcf.pyx":1616
 *                 for i in range(fmt0.n):
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     a = (data8[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 */
        goto __pyx_L12_break;
      }

      /* "pysam/cbcf.pyx":1617
 *                     if data8[i] == bcf_int8_vector_end:
 *                         break
 *                     a = (data8[i] >> 1) - 1             # <<<<<<<<<<<<<<
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT16:
 */
      __pyx_v_a = (((__pyx_v_data8[__pyx_v_i]) >> 1) - 1);

      /* "pysam/cbcf.pyx":1618
 *                         break
 *                     a = (data8[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 */
      __pyx_t_4 = (0 <= __pyx_v_a);
      if (__pyx_t_4) {
        __pyx_t_4 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if ((__pyx_t_4 != 0)) {
        __pyx_t_10 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[__pyx_v_a])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __pyx_t_10;
        __pyx_t_10 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_7 = Py_None;
      }
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L12_break:;
    goto __pyx_L10;
  }

  /* "pysam/cbcf.pyx":1619
 *                     a = (data8[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_4 = ((__pyx_v_fmt0->type == BCF_BT_INT16) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1620
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1621
 *             elif fmt0.type == BCF_BT_INT16:
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break
 */
    __pyx_t_8 = __pyx_v_fmt0->n;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/cbcf.pyx":1622
 *                 data16 = <int16_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     a = (data16[i] >> 1) - 1
 */
      __pyx_t_4 = (((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end) != 0);
      if (__pyx_t_4) {

        /* "pysam/cbcf.pyx":1623
 *                 for i in range(fmt0.n):
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     a = (data16[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 */
        goto __pyx_L15_break;
      }

      /* "pysam/cbcf.pyx":1624
 *                     if data16[i] == bcf_int16_vector_end:
 *                         break
 *                     a = (data16[i] >> 1) - 1             # <<<<<<<<<<<<<<
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT32:
 */
      __pyx_v_a = (((__pyx_v_data16[__pyx_v_i]) >> 1) - 1);

      /* "pysam/cbcf.pyx":1625
 *                         break
 *                     a = (data16[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 */
      __pyx_t_4 = (0 <= __pyx_v_a);
      if (__pyx_t_4) {
        __pyx_t_4 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if ((__pyx_t_4 != 0)) {
        __pyx_t_10 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[__pyx_v_a])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __pyx_t_10;
        __pyx_t_10 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_7 = Py_None;
      }
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L15_break:;
    goto __pyx_L10;
  }

  /* "pysam/cbcf.pyx":1626
 *                     a = (data16[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 */
  __pyx_t_4 = ((__pyx_v_fmt0->type == BCF_BT_INT32) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1627
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.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_self->index * __pyx_v_fmt0->size)));

    /* "pysam/cbcf.pyx":1628
 *             elif fmt0.type == BCF_BT_INT32:
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break
 */
    __pyx_t_8 = __pyx_v_fmt0->n;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/cbcf.pyx":1629
 *                 data32 = <int32_t *>(fmt0.p + self.index * fmt0.size)
 *                 for i in range(fmt0.n):
 *                     if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                         break
 *                     a = (data32[i] >> 1) - 1
 */
      __pyx_t_4 = (((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end) != 0);
      if (__pyx_t_4) {

        /* "pysam/cbcf.pyx":1630
 *                 for i in range(fmt0.n):
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break             # <<<<<<<<<<<<<<
 *                     a = (data32[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 */
        goto __pyx_L18_break;
      }

      /* "pysam/cbcf.pyx":1631
 *                     if data32[i] == bcf_int32_vector_end:
 *                         break
 *                     a = (data32[i] >> 1) - 1             # <<<<<<<<<<<<<<
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 * 
 */
      __pyx_v_a = (((__pyx_v_data32[__pyx_v_i]) >> 1) - 1);

      /* "pysam/cbcf.pyx":1632
 *                         break
 *                     a = (data32[i] >> 1) - 1
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 * 
 *             return tuple(alleles)
 */
      __pyx_t_4 = (0 <= __pyx_v_a);
      if (__pyx_t_4) {
        __pyx_t_4 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if ((__pyx_t_4 != 0)) {
        __pyx_t_10 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[__pyx_v_a])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __pyx_t_10;
        __pyx_t_10 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_7 = Py_None;
      }
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L18_break:;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "pysam/cbcf.pyx":1634
 *                     alleles.append(r.d.allele[a] if 0 <= a < nalleles else None)
 * 
 *             return tuple(alleles)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyList_AsTuple(__pyx_v_alleles); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1591
 *     property alleles:
 *         """alleles for called genotype, if present.  Otherwise None"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf_hdr_t *h = self.record.header.ptr
 *             cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.alleles.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alleles);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1636
 *             return tuple(alleles)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordSample_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_19VariantRecordSample_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample___len__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_19VariantRecordSample___len__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1636);

  /* "pysam/cbcf.pyx":1637
 * 
 *     def __len__(self):
 *         return self.record.ptr.n_fmt             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __pyx_r = __pyx_v_self->record->ptr->n_fmt;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1636
 *             return tuple(alleles)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt
 * 
 */

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

/* "pysam/cbcf.pyx":1639
 *         return self.record.ptr.n_fmt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_19VariantRecordSample_3__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordSample_3__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_2__bool__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordSample_2__bool__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1639);

  /* "pysam/cbcf.pyx":1640
 * 
 *     def __bool__(self):
 *         return self.record.ptr.n_fmt != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = (__pyx_v_self->record->ptr->n_fmt != 0);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1639
 *         return self.record.ptr.n_fmt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_fmt != 0
 * 
 */

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

/* "pysam/cbcf.pyx":1642
 *         return self.record.ptr.n_fmt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_4__getitem__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_4__getitem__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_v_index;
  PyObject *__pyx_r = NULL;
  __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;
  struct __pyx_opt_args_5pysam_4cbcf_bcf_array_to_object __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1642);

  /* "pysam/cbcf.pyx":1643
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = 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_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1644
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef int index
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1648
 *         cdef int index
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= r.n_fmt:
 */
  __pyx_t_3 = PyInt_Check(__pyx_v_key); 
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1649
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 *             if index < 0 or index >= r.n_fmt:
 *                 raise IndexError('invalid format index')
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index = __pyx_t_5;

    /* "pysam/cbcf.pyx":1650
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= r.n_fmt:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid format index')
 *             fmt = r.d.fmt + index
 */
    __pyx_t_3 = ((__pyx_v_index < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_4 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_index >= __pyx_v_r->n_fmt) != 0);
    __pyx_t_4 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_4) {

      /* "pysam/cbcf.pyx":1651
 *             index = key
 *             if index < 0 or index >= r.n_fmt:
 *                 raise IndexError('invalid format index')             # <<<<<<<<<<<<<<
 *             fmt = r.d.fmt + index
 *         else:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":1652
 *             if index < 0 or index >= r.n_fmt:
 *                 raise IndexError('invalid format index')
 *             fmt = r.d.fmt + index             # <<<<<<<<<<<<<<
 *         else:
 *             fmt = bcf_get_fmt(h, r, key)
 */
    __pyx_v_fmt = (__pyx_v_r->d.fmt + __pyx_v_index);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1654
 *             fmt = r.d.fmt + index
 *         else:
 *             fmt = bcf_get_fmt(h, r, key)             # <<<<<<<<<<<<<<
 * 
 *         if not fmt:
 */
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fmt = bcf_get_fmt(__pyx_v_h, __pyx_v_r, __pyx_t_7);
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1656
 *             fmt = bcf_get_fmt(h, r, key)
 * 
 *         if not fmt:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid format requested')
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_fmt != 0)) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1657
 * 
 *         if not fmt:
 *             raise KeyError('invalid format requested')             # <<<<<<<<<<<<<<
 * 
 *         if is_gt_fmt(h, fmt):
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1659
 *             raise KeyError('invalid format requested')
 * 
 *         if is_gt_fmt(h, fmt):             # <<<<<<<<<<<<<<
 *             return self.alleles
 *         elif fmt.p and fmt.n and fmt.size:
 */
  __pyx_t_4 = (__pyx_f_5pysam_4cbcf_is_gt_fmt(__pyx_v_h, __pyx_v_fmt) != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1660
 * 
 *         if is_gt_fmt(h, fmt):
 *             return self.alleles             # <<<<<<<<<<<<<<
 *         elif fmt.p and fmt.n and fmt.size:
 *             return bcf_array_to_object(fmt.p + self.index * fmt.size, fmt.type, fmt.n, scalar=1)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alleles); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1661
 *         if is_gt_fmt(h, fmt):
 *             return self.alleles
 *         elif fmt.p and fmt.n and fmt.size:             # <<<<<<<<<<<<<<
 *             return bcf_array_to_object(fmt.p + self.index * fmt.size, fmt.type, fmt.n, scalar=1)
 *         else:
 */
  __pyx_t_3 = (__pyx_v_fmt->p != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_fmt->n != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_fmt->size != 0);
  __pyx_t_4 = __pyx_t_3;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":1662
 *             return self.alleles
 *         elif fmt.p and fmt.n and fmt.size:
 *             return bcf_array_to_object(fmt.p + self.index * fmt.size, fmt.type, fmt.n, scalar=1)             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.scalar = 1;
    __pyx_t_6 = __pyx_f_5pysam_4cbcf_bcf_array_to_object((__pyx_v_fmt->p + (__pyx_v_self->index * __pyx_v_fmt->size)), __pyx_v_fmt->type, __pyx_v_fmt->n, &__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1664
 *             return bcf_array_to_object(fmt.p + self.index * fmt.size, fmt.type, fmt.n, scalar=1)
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1642
 *         return self.record.ptr.n_fmt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_8generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1666
 *             return None
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_6__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_6__iter__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_30___iter__(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_30___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1666);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordSample_8generator20, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VariantRecordSample___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_8generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1667
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_fmt
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1668
 *     def __iter__(self):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = r.n_fmt
 * 
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1669
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = r.n_fmt             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_fmt;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/cbcf.pyx":1671
 *         cdef int i, n = r.n_fmt
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].id)
 * 
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  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/cbcf.pyx":1672
 * 
 *         for i in range(n):
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].id)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_6 = __Pyx_PyBytes_FromString(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_h, BCF_DT_ID, (__pyx_cur_scope->__pyx_v_r->d.fmt[__pyx_cur_scope->__pyx_v_i]).id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __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_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1666
 *             return None
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1674
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].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_4cbcf_19VariantRecordSample_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_9get[] = "VariantRecordSample.get(self, key, default=None)\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_9get(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_9get(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 1674);

  /* "pysam/cbcf.pyx":1676
 *     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_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/cbcf.pyx":1677
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1678
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1679
 *             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;
    __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/cbcf.pyx":1674
 *             yield bcf_hdr_int2id(h, BCF_DT_ID, r.d.fmt[i].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.cbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1681
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_19VariantRecordSample_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_19VariantRecordSample_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_11__contains__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_19VariantRecordSample_11__contains__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_h;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  char const *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1681);

  /* "pysam/cbcf.pyx":1682
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 */
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_h = __pyx_t_1;

  /* "pysam/cbcf.pyx":1683
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 *         return fmt != NULL
 */
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/cbcf.pyx":1684
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)             # <<<<<<<<<<<<<<
 *         return fmt != NULL
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_h, __pyx_v_r, __pyx_t_3);

  /* "pysam/cbcf.pyx":1685
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(h, r, key)
 *         return fmt != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __pyx_r = (__pyx_v_fmt != NULL);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1681
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *h = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1687
 *         return fmt != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_13iterkeys[] = "VariantRecordSample.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_14iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_13iterkeys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_13iterkeys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1687);

  /* "pysam/cbcf.pyx":1689
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1687
 *         return fmt != 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.cbcf.VariantRecordSample.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_17generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1691
 *         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_4cbcf_19VariantRecordSample_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_15itervalues[] = "VariantRecordSample.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_16itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_15itervalues(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_15itervalues(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_31_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_31_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1691);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordSample_17generator21, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_VariantRecordSample_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_17generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1693
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1694
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1691
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_20generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1696
 *             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_4cbcf_19VariantRecordSample_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_18iteritems[] = "VariantRecordSample.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_19iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_18iteritems(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_18iteritems(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_32_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_32_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1696);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_19VariantRecordSample_20generator22, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_VariantRecordSample_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_19VariantRecordSample_20generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1698
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1699
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1696
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1701
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_21keys[] = "VariantRecordSample.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_22keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_21keys(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_21keys(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1701);

  /* "pysam/cbcf.pyx":1703
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1701
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.VariantRecordSample.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1705
 *         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_4cbcf_19VariantRecordSample_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_23items[] = "VariantRecordSample.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_24items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_23items(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_23items(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1705);

  /* "pysam/cbcf.pyx":1707
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1705
 *         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.cbcf.VariantRecordSample.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1709
 *         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_4cbcf_19VariantRecordSample_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_19VariantRecordSample_25values[] = "VariantRecordSample.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_26values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_25values(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_25values(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1709);

  /* "pysam/cbcf.pyx":1711
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1709
 *         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.cbcf.VariantRecordSample.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":109
 * cdef class VariantRecordSample(object):
 *     cdef VariantRecord record
 *     cdef readonly int32_t index             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_19VariantRecordSample_5index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_19VariantRecordSample_5index___get__(((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_19VariantRecordSample_5index___get__(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 109);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __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.cbcf.VariantRecordSample.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1719
 * 
 * 
 * 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_4cbcf_VariantRecordSample *__pyx_f_5pysam_4cbcf_makeVariantRecordSample(struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record, int32_t __pyx_v_sample_index) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_v_sample = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeVariantRecordSample", 0);
  __Pyx_TraceCall("makeVariantRecordSample", __pyx_f[0], 1719);

  /* "pysam/cbcf.pyx":1720
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((!__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_v_sample_index < 0) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1721
 * 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__55, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1723
 *         raise ValueError('cannot create VariantRecordSample')
 * 
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)             # <<<<<<<<<<<<<<
 *     sample.record = record
 *     sample.index = sample_index
 */
  __pyx_t_4 = __pyx_tp_new_5pysam_4cbcf_VariantRecordSample(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantRecordSample)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5pysam_4cbcf_VariantRecordSample)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_sample = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/cbcf.pyx":1724
 * 
 *     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(__pyx_v_sample->record);
  __Pyx_DECREF(((PyObject *)__pyx_v_sample->record));
  __pyx_v_sample->record = __pyx_v_record;

  /* "pysam/cbcf.pyx":1725
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)
 *     sample.record = record
 *     sample.index = sample_index             # <<<<<<<<<<<<<<
 * 
 *     return sample
 */
  __pyx_v_sample->index = __pyx_v_sample_index;

  /* "pysam/cbcf.pyx":1727
 *     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/cbcf.pyx":1719
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1737
 * 
 * cdef class BaseIndex(object):
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.remap = {}
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex___init__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_9BaseIndex___init__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1737);

  /* "pysam/cbcf.pyx":1738
 * 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/cbcf.pyx":1739
 *     def __init__(self):
 *         self.refs = ()
 *         self.remap = {}             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":1737
 * 
 * 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.cbcf.BaseIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1741
 *         self.remap = {}
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5pysam_4cbcf_9BaseIndex_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5pysam_4cbcf_9BaseIndex_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_2__len__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_5pysam_4cbcf_9BaseIndex_2__len__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1741);

  /* "pysam/cbcf.pyx":1742
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1741
 *         self.remap = {}
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1744
 *         return len(self.refs)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs) != 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_5__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_4__bool__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_9BaseIndex_4__bool__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  int __pyx_r;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceCall("__bool__", __pyx_f[0], 1744);

  /* "pysam/cbcf.pyx":1745
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 != 0);
  goto __pyx_L0;

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

/* "pysam/cbcf.pyx":1747
 *         return len(self.refs) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if isinstance(key, int):
 *             return self.refs[key]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_6__getitem__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_6__getitem__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1747);

  /* "pysam/cbcf.pyx":1748
 * 
 *     def __getitem__(self, key):
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             return self.refs[key]
 *         else:
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_key); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1749
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = PyObject_GetItem(__pyx_v_self->refs, __pyx_v_key); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1751
 *             return self.refs[key]
 *         else:
 *             return self.refmap[key]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_self->refmap == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->refmap, __pyx_v_key); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1747
 *         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_3);
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1753
 *             return self.refmap[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.refs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_8__iter__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_8__iter__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1753);

  /* "pysam/cbcf.pyx":1754
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1753
 *             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.cbcf.BaseIndex.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1756
 *         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_4cbcf_9BaseIndex_11get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_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 PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_11get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_10get(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_10get(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceCall("get", __pyx_f[0], 1756);

  /* "pysam/cbcf.pyx":1758
 *     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_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/cbcf.pyx":1759
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1760
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1761
 *             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;
    __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/cbcf.pyx":1756
 *         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.cbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1763
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_4cbcf_9BaseIndex_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_12__contains__(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_4cbcf_9BaseIndex_12__contains__(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceCall("__contains__", __pyx_f[0], 1763);

  /* "pysam/cbcf.pyx":1764
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
 */
  {
    __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/cbcf.pyx":1765
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    /*else:*/ {

      /* "pysam/cbcf.pyx":1769
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
      __pyx_r = 1;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/cbcf.pyx":1766
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.cbcf.BaseIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pysam/cbcf.pyx":1767
 *             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;
    __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/cbcf.pyx":1763
 *             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.cbcf.BaseIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1771
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_15iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_14iterkeys[] = "BaseIndex.iterkeys(self)\nD.iterkeys() -> an iterator over the keys of D";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_15iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_14iterkeys(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_14iterkeys(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceCall("iterkeys", __pyx_f[0], 1771);

  /* "pysam/cbcf.pyx":1773
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1771
 *             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.cbcf.BaseIndex.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_4cbcf_9BaseIndex_18generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1775
 *         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_4cbcf_9BaseIndex_17itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_16itervalues[] = "BaseIndex.itervalues(self)\nD.itervalues() -> an iterator over the values of D";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_17itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_16itervalues(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_16itervalues(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_33_itervalues(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_33_itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("itervalues", __pyx_f[0], 1775);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_9BaseIndex_18generator23, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_BaseIndex_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_9BaseIndex_18generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1777
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1778
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1775
 *         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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_5pysam_4cbcf_9BaseIndex_21generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pysam/cbcf.pyx":1780
 *             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_4cbcf_9BaseIndex_20iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_19iteritems[] = "BaseIndex.iteritems(self)\nD.iteritems() -> an iterator over the (key, value) items of D";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_20iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_19iteritems(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_19iteritems(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *)__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_34_iteritems(__pyx_ptype_5pysam_4cbcf___pyx_scope_struct_34_iteritems, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_TraceCall("iteritems", __pyx_f[0], 1780);
  __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cbcf_9BaseIndex_21generator24, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_BaseIndex_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_4cbcf_9BaseIndex_21generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysam/cbcf.pyx":1782
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1783
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __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_RefNannyFinishContext();
    /* 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_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pysam/cbcf.pyx":1780
 *             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_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_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "pysam/cbcf.pyx":1785
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_23keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_22keys[] = "BaseIndex.keys(self)\nD.keys() -> list of D's keys";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_23keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_22keys(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_22keys(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceCall("keys", __pyx_f[0], 1785);

  /* "pysam/cbcf.pyx":1787
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1785
 *             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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.BaseIndex.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1789
 *         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_4cbcf_9BaseIndex_25items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_24items[] = "BaseIndex.items(self)\nD.items() -> list of D's (key, value) pairs, as 2-tuples";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_25items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_24items(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_24items(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceCall("items", __pyx_f[0], 1789);

  /* "pysam/cbcf.pyx":1791
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1789
 *         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.cbcf.BaseIndex.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1793
 *         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_4cbcf_9BaseIndex_27values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_9BaseIndex_26values[] = "BaseIndex.values(self)\nD.values() -> list of D's values";
static PyObject *__pyx_pw_5pysam_4cbcf_9BaseIndex_27values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_9BaseIndex_26values(((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_9BaseIndex_26values(struct __pyx_obj_5pysam_4cbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceCall("values", __pyx_f[0], 1793);

  /* "pysam/cbcf.pyx":1795
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1793
 *         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.cbcf.BaseIndex.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1805
 * 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_4cbcf_8BCFIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_8BCFIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_5pysam_4cbcf_8BCFIndex___init__(((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_8BCFIndex___init__(struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self) {
  int __pyx_v_n;
  char const **__pyx_v_refs;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  struct __pyx_opt_args_5pysam_4cbcf_char_array_to_tuple __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1805);

  /* "pysam/cbcf.pyx":1806
 *     """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/cbcf.pyx":1807
 *     def __init__(self):
 *         self.refs = ()
 *         self.refmap = {}             # <<<<<<<<<<<<<<
 * 
 *         if not self.ptr:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1809
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ptr != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1810
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1813
 * 
 *         cdef int n
 *         cdef const char **refs = bcf_index_seqnames(self.ptr, self.header.ptr, &n)             # <<<<<<<<<<<<<<
 * 
 *         if not refs:
 */
  __pyx_v_refs = bcf_index_seqnames(__pyx_v_self->ptr, __pyx_v_self->header->ptr, (&__pyx_v_n));

  /* "pysam/cbcf.pyx":1815
 *         cdef const char **refs = bcf_index_seqnames(self.ptr, self.header.ptr, &n)
 * 
 *         if not refs:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot retrieve reference sequence names')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_refs != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1816
 * 
 *         if not refs:
 *             raise ValueError('Cannot retrieve reference sequence names')             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1818
 *             raise ValueError('Cannot retrieve reference sequence names')
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)             # <<<<<<<<<<<<<<
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 */
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.free_after = 1;
  __pyx_t_1 = __pyx_f_5pysam_4cbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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/cbcf.pyx":1819
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  { /* enter inner scope */
    PyObject *__pyx_7genexpr__pyx_v_i = NULL;
    PyObject *__pyx_7genexpr__pyx_v_r = NULL;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_4 = __pyx_int_0;
    __pyx_t_5 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    for (;;) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_r, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_4);
      __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_7;
      __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_r, (PyObject*)__pyx_7genexpr__pyx_v_i))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_r);
    goto __pyx_L10_exit_scope;
    __pyx_L7_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_r);
    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/cbcf.pyx":1805
 * 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.cbcf.BCFIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1821
 *         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_4cbcf_8BCFIndex_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_8BCFIndex_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_8BCFIndex_2__dealloc__(((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_8BCFIndex_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1821);

  /* "pysam/cbcf.pyx":1822
 * 
 *     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/cbcf.pyx":1823
 *     def __dealloc__(self):
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    hts_idx_destroy(__pyx_v_self->ptr);

    /* "pysam/cbcf.pyx":1824
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):
 */
    __pyx_v_self->ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1821
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)
 */

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

/* "pysam/cbcf.pyx":1826
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, region, reopen)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_8BCFIndex_5fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_8BCFIndex_4fetch[] = "BCFIndex.fetch(self, bcf, contig, start, stop, region, reopen)";
static PyObject *__pyx_pw_5pysam_4cbcf_8BCFIndex_5fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bcf = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contig)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_region)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reopen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_bcf = values[0];
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_region = values[4];
    __pyx_v_reopen = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.BCFIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_8BCFIndex_4fetch(((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen);

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

static PyObject *__pyx_pf_5pysam_4cbcf_8BCFIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceCall("fetch", __pyx_f[0], 1826);

  /* "pysam/cbcf.pyx":1827
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):
 *         return BCFIterator(bcf, contig, start, stop, region, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_bcf);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bcf);
  __Pyx_GIVEREF(__pyx_v_bcf);
  __Pyx_INCREF(__pyx_v_contig);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  __Pyx_INCREF(__pyx_v_start);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  __Pyx_INCREF(__pyx_v_region);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_region);
  __Pyx_GIVEREF(__pyx_v_region);
  __Pyx_INCREF(__pyx_v_reopen);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_reopen);
  __Pyx_GIVEREF(__pyx_v_reopen);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_BCFIterator)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1826
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, region, reopen)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.BCFIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1830
 * 
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
 */

static struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_f_5pysam_4cbcf_makeBCFIndex(struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, hts_idx_t *__pyx_v_idx) {
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_index = 0;
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("makeBCFIndex", 0);
  __Pyx_TraceCall("makeBCFIndex", __pyx_f[0], 1830);

  /* "pysam/cbcf.pyx":1831
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_idx != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1832
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     if not header:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1834
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1835
 * 
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1837
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)             # <<<<<<<<<<<<<<
 *     index.header = header
 *     index.ptr = idx
 */
  __pyx_t_3 = __pyx_tp_new_5pysam_4cbcf_BCFIndex(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_BCFIndex)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_4cbcf_BCFIndex)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_index = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/cbcf.pyx":1838
 * 
 *     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(__pyx_v_index->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_index->header));
  __pyx_v_index->header = __pyx_v_header;

  /* "pysam/cbcf.pyx":1839
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 *     index.header = header
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
 */
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/cbcf.pyx":1840
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1842
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
  __pyx_r = __pyx_v_index;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1830
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1847
 * 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_4cbcf_10TabixIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_10TabixIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_5pysam_4cbcf_10TabixIndex___init__(((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_4cbcf_10TabixIndex___init__(struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self) {
  int __pyx_v_n;
  char const **__pyx_v_refs;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  struct __pyx_opt_args_5pysam_4cbcf_char_array_to_tuple __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1847);

  /* "pysam/cbcf.pyx":1848
 *     """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/cbcf.pyx":1849
 *     def __init__(self):
 *         self.refs = ()
 *         self.refmap = {}             # <<<<<<<<<<<<<<
 * 
 *         if not self.ptr:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1851
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ptr != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1852
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1855
 * 
 *         cdef int n
 *         cdef const char **refs = tbx_seqnames(self.ptr, &n)             # <<<<<<<<<<<<<<
 * 
 *         if not refs:
 */
  __pyx_v_refs = tbx_seqnames(__pyx_v_self->ptr, (&__pyx_v_n));

  /* "pysam/cbcf.pyx":1857
 *         cdef const char **refs = tbx_seqnames(self.ptr, &n)
 * 
 *         if not refs:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot retrieve reference sequence names')
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_refs != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1858
 * 
 *         if not refs:
 *             raise ValueError('Cannot retrieve reference sequence names')             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1860
 *             raise ValueError('Cannot retrieve reference sequence names')
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)             # <<<<<<<<<<<<<<
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 */
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.free_after = 1;
  __pyx_t_1 = __pyx_f_5pysam_4cbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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/cbcf.pyx":1861
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  { /* enter inner scope */
    PyObject *__pyx_8genexpr1__pyx_v_i = NULL;
    PyObject *__pyx_8genexpr1__pyx_v_r = NULL;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_4 = __pyx_int_0;
    __pyx_t_5 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    for (;;) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_r, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_i, __pyx_t_4);
      __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_7;
      __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_r, (PyObject*)__pyx_8genexpr1__pyx_v_i))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i);
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_r);
    goto __pyx_L10_exit_scope;
    __pyx_L7_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i);
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_r);
    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/cbcf.pyx":1847
 * 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysam.cbcf.TabixIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1863
 *         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_4cbcf_10TabixIndex_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_10TabixIndex_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_10TabixIndex_2__dealloc__(((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_10TabixIndex_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1863);

  /* "pysam/cbcf.pyx":1864
 * 
 *     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/cbcf.pyx":1865
 *     def __dealloc__(self):
 *         if self.ptr:
 *             tbx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
 */
    tbx_destroy(__pyx_v_self->ptr);

    /* "pysam/cbcf.pyx":1866
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):
 */
    __pyx_v_self->ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1863
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
 */

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

/* "pysam/cbcf.pyx":1868
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, region, reopen)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_10TabixIndex_5fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_10TabixIndex_4fetch[] = "TabixIndex.fetch(self, bcf, contig, start, stop, region, reopen)";
static PyObject *__pyx_pw_5pysam_4cbcf_10TabixIndex_5fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bcf = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contig)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_region)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reopen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_bcf = values[0];
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_region = values[4];
    __pyx_v_reopen = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.TabixIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_10TabixIndex_4fetch(((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen);

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

static PyObject *__pyx_pf_5pysam_4cbcf_10TabixIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceCall("fetch", __pyx_f[0], 1868);

  /* "pysam/cbcf.pyx":1869
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):
 *         return TabixIterator(bcf, contig, start, stop, region, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_bcf);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bcf);
  __Pyx_GIVEREF(__pyx_v_bcf);
  __Pyx_INCREF(__pyx_v_contig);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  __Pyx_INCREF(__pyx_v_start);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  __Pyx_INCREF(__pyx_v_region);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_region);
  __Pyx_GIVEREF(__pyx_v_region);
  __Pyx_INCREF(__pyx_v_reopen);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_reopen);
  __Pyx_GIVEREF(__pyx_v_reopen);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_TabixIterator)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1868
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, region, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, region, reopen)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysam.cbcf.TabixIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1872
 * 
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
 */

static struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_f_5pysam_4cbcf_makeTabixIndex(tbx_t *__pyx_v_idx) {
  struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_index = 0;
  struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_r = NULL;
  __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_TraceDeclarations
  __Pyx_RefNannySetupContext("makeTabixIndex", 0);
  __Pyx_TraceCall("makeTabixIndex", __pyx_f[0], 1872);

  /* "pysam/cbcf.pyx":1873
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_idx != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1874
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":1876
 *         return None
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)             # <<<<<<<<<<<<<<
 *     index.ptr = idx
 *     index.__init__()
 */
  __pyx_t_2 = __pyx_tp_new_5pysam_4cbcf_TabixIndex(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_TabixIndex)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5pysam_4cbcf_TabixIndex)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_index = ((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/cbcf.pyx":1877
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
 */
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/cbcf.pyx":1878
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1880
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
  __pyx_r = __pyx_v_index;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":1872
 * 
 * 
 * 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.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1895
 * # Interal 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_4cbcf__stop_BCFIterator(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self, bcf1_t *__pyx_v_record) {
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("_stop_BCFIterator", 0);
  __Pyx_TraceCall("_stop_BCFIterator", __pyx_f[0], 1895);

  /* "pysam/cbcf.pyx":1896
 * # 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/cbcf.pyx":1899
 * 
 *     # 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/cbcf.pyx":1900
 *     # 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/cbcf.pyx":1895
 * # Interal function to clean up after iteration stop or failure.
 * # This would be a nested function if it weren't a cdef function.
 * cdef void _stop_BCFIterator(BCFIterator self, bcf1_t *record):             # <<<<<<<<<<<<<<
 *     bcf_destroy1(record)
 * 
 */

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

/* "pysam/cbcf.pyx":1904
 * 
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_11BCFIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_11BCFIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contig);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_region);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reopen);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bcf = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)values[0]);
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_region = values[4];
    __pyx_v_reopen = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.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_4cbcf_VariantFile, 1, "bcf", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5pysam_4cbcf_11BCFIterator___init__(((struct __pyx_obj_5pysam_4cbcf_BCFIterator *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5pysam_4cbcf_11BCFIterator___init__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen) {
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *__pyx_v_index = 0;
  PyObject *__pyx_v_rid = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  char *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1904);
  __Pyx_INCREF((PyObject *)__pyx_v_bcf);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);

  /* "pysam/cbcf.pyx":1906
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):
 * 
 *         if not isinstance(bcf.index, BCFIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_5pysam_4cbcf_BCFIndex)); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1907
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef BCFIndex index = bcf.index
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1909
 *             raise ValueError('bcf index required')
 * 
 *         cdef BCFIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         if not index:
 */
  if (!(likely(((((PyObject *)__pyx_v_bcf->index)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_bcf->index), __pyx_ptype_5pysam_4cbcf_BCFIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_index = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":1911
 *         cdef BCFIndex index = bcf.index
 * 
 *         if not index:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1912
 * 
 *         if not index:
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1914
 *             raise ValueError('bcf index required')
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             bcf = bcf.copy()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1915
 * 
 *         if reopen:
 *             bcf = bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         if region is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bcf), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_4cbcf_VariantFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_bcf, ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysam/cbcf.pyx":1917
 *             bcf = bcf.copy()
 * 
 *         if region is not None:             # <<<<<<<<<<<<<<
 *             if contig is not None or start is not None or stop is not None:
 *                 raise ValueError  # FIXME
 */
  __pyx_t_2 = (__pyx_v_region != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1918
 * 
 *         if region is not None:
 *             if contig is not None or start is not None or stop is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError  # FIXME
 * 
 */
    __pyx_t_2 = (__pyx_v_contig != Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (!__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_start != Py_None);
    __pyx_t_2 = (__pyx_t_6 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_stop != Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    __pyx_t_3 = __pyx_t_6;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/cbcf.pyx":1919
 *         if region is not None:
 *             if contig is not None or start is not None or stop is not None:
 *                 raise ValueError  # FIXME             # <<<<<<<<<<<<<<
 * 
 *             self.iter = bcf_itr_querys(index.ptr, bcf.header.ptr, region)
 */
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":1921
 *                 raise ValueError  # FIXME
 * 
 *             self.iter = bcf_itr_querys(index.ptr, bcf.header.ptr, region)             # <<<<<<<<<<<<<<
 *         else:
 *             if contig is None:
 */
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->__pyx_base.iter = bcf_itr_querys(__pyx_v_index->ptr, __pyx_v_bcf->header->ptr, __pyx_t_7);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":1923
 *             self.iter = bcf_itr_querys(index.ptr, bcf.header.ptr, region)
 *         else:
 *             if contig is None:             # <<<<<<<<<<<<<<
 *                 raise ValueError  # FIXME
 * 
 */
    __pyx_t_3 = (__pyx_v_contig == Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "pysam/cbcf.pyx":1924
 *         else:
 *             if contig is None:
 *                 raise ValueError  # FIXME             # <<<<<<<<<<<<<<
 * 
 *             rid = index.refmap.get(contig, -1)
 */
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":1926
 *                 raise ValueError  # FIXME
 * 
 *             rid = index.refmap.get(contig, -1)             # <<<<<<<<<<<<<<
 * 
 *             if start is None:
 */
    if (unlikely(__pyx_v_index->__pyx_base.refmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_index->__pyx_base.refmap, __pyx_v_contig, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rid = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysam/cbcf.pyx":1928
 *             rid = index.refmap.get(contig, -1)
 * 
 *             if start is None:             # <<<<<<<<<<<<<<
 *                 start = 0
 *             if stop is None:
 */
    __pyx_t_6 = (__pyx_v_start == Py_None);
    __pyx_t_3 = (__pyx_t_6 != 0);
    if (__pyx_t_3) {

      /* "pysam/cbcf.pyx":1929
 * 
 *             if start is None:
 *                 start = 0             # <<<<<<<<<<<<<<
 *             if stop is None:
 *                 stop = MAX_POS
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_0);
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "pysam/cbcf.pyx":1930
 *             if start is None:
 *                 start = 0
 *             if stop is None:             # <<<<<<<<<<<<<<
 *                 stop = MAX_POS
 * 
 */
    __pyx_t_3 = (__pyx_v_stop == Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "pysam/cbcf.pyx":1931
 *                 start = 0
 *             if stop is None:
 *                 stop = MAX_POS             # <<<<<<<<<<<<<<
 * 
 *             self.iter = bcf_itr_queryi(index.ptr, rid, start, stop)
 */
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_5pysam_4cbcf_MAX_POS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "pysam/cbcf.pyx":1933
 *                 stop = MAX_POS
 * 
 *             self.iter = bcf_itr_queryi(index.ptr, rid, start, stop)             # <<<<<<<<<<<<<<
 * 
 *         # Do not fail on self.iter == NULL, since it signifies a null query.
 */
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_rid); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->__pyx_base.iter = bcf_itr_queryi(__pyx_v_index->ptr, __pyx_t_8, __pyx_t_9, __pyx_t_10);
  }
  __pyx_L6:;

  /* "pysam/cbcf.pyx":1937
 *         # Do not fail on self.iter == NULL, since it signifies a null query.
 * 
 *         self.bcf = bcf             # <<<<<<<<<<<<<<
 *         self.index = index
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_bcf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_bcf));
  __Pyx_GOTREF(__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/cbcf.pyx":1938
 * 
 *         self.bcf = bcf
 *         self.index = index             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
  __Pyx_GOTREF(__pyx_v_self->index);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
  __pyx_v_self->index = __pyx_v_index;

  /* "pysam/cbcf.pyx":1904
 * 
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_rid);
  __Pyx_XDECREF((PyObject *)__pyx_v_bcf);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1940
 *         self.index = index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 */

/* Python wrapper */
static void __pyx_pw_5pysam_4cbcf_11BCFIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_11BCFIterator_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_11BCFIterator_2__dealloc__(((struct __pyx_obj_5pysam_4cbcf_BCFIterator *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_11BCFIterator_2__dealloc__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1940);

  /* "pysam/cbcf.pyx":1941
 * 
 *     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/cbcf.pyx":1942
 *     def __dealloc__(self):
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 * 
 */
    bcf_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/cbcf.pyx":1943
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_v_self->__pyx_base.iter = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":1940
 *         self.index = index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 */

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

/* "pysam/cbcf.pyx":1945
 *             self.iter = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11BCFIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11BCFIterator_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11BCFIterator_4__iter__(((struct __pyx_obj_5pysam_4cbcf_BCFIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11BCFIterator_4__iter__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1945);

  /* "pysam/cbcf.pyx":1946
 * 
 *     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/cbcf.pyx":1945
 *             self.iter = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "pysam/cbcf.pyx":1948
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11BCFIterator_7__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11BCFIterator_7__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11BCFIterator_6__next__(((struct __pyx_obj_5pysam_4cbcf_BCFIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11BCFIterator_6__next__(struct __pyx_obj_5pysam_4cbcf_BCFIterator *__pyx_v_self) {
  bcf1_t *__pyx_v_record;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceCall("__next__", __pyx_f[0], 1948);

  /* "pysam/cbcf.pyx":1949
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_self->__pyx_base.iter != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1950
 *     def __next__(self):
 *         if not self.iter:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1952
 *             raise StopIteration
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/cbcf.pyx":1954
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
 */
  __pyx_v_record->pos = -1;

  /* "pysam/cbcf.pyx":1955
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base.bcf->drop_samples != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1956
 *         record.pos = -1
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 */
    __pyx_v_record->max_unpack = BCF_UN_SHR;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pysam/cbcf.pyx":1958
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         cdef int 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->htsfile, __pyx_v_self->__pyx_base.iter, __pyx_v_record);

  /* "pysam/cbcf.pyx":1960
 *         cdef int 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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1961
 * 
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
 */
    __pyx_f_5pysam_4cbcf__stop_BCFIterator(__pyx_v_self, __pyx_v_record);

    /* "pysam/cbcf.pyx":1962
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             else:
 */
    __pyx_t_1 = ((__pyx_v_ret == -1) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":1963
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('error reading BCF file')
 */
      __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":1965
 *                 raise StopIteration
 *             else:
 *                 raise ValueError('error reading BCF file')             # <<<<<<<<<<<<<<
 * 
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }

  /* "pysam/cbcf.pyx":1967
 *                 raise ValueError('error reading BCF file')
 * 
 *         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/cbcf.pyx":1969
 *         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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":1970
 * 
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)             # <<<<<<<<<<<<<<
 *             raise ValueError('error in bcf_subset_format')
 * 
 */
    __pyx_f_5pysam_4cbcf__stop_BCFIterator(__pyx_v_self, __pyx_v_record);

    /* "pysam/cbcf.pyx":1971
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1973
 *             raise ValueError('error in bcf_subset_format')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_2), __pyx_v_record)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":1948
 *         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_AddTraceback("pysam.cbcf.BCFIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":1977
 * 
 * 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_4cbcf_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_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;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : 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_4cbcf_13TabixIterator___cinit__(((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_5pysam_4cbcf_13TabixIterator___cinit__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1977);

  /* "pysam/cbcf.pyx":1978
 * 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/cbcf.pyx":1979
 *     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/cbcf.pyx":1980
 *         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, region=None, reopen=True):
 */
  __pyx_v_self->line_buffer.s = NULL;

  /* "pysam/cbcf.pyx":1977
 * 
 * cdef class TabixIterator(BaseIterator):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0
 */

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

/* "pysam/cbcf.pyx":1982
 *         self.line_buffer.s = NULL
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_13TabixIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_13TabixIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bcf,&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contig);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_region);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reopen);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bcf = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)values[0]);
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_region = values[4];
    __pyx_v_reopen = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.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_4cbcf_VariantFile, 1, "bcf", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5pysam_4cbcf_13TabixIterator_2__init__(((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5pysam_4cbcf_13TabixIterator_2__init__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen) {
  struct __pyx_obj_5pysam_4cbcf_TabixIndex *__pyx_v_index = 0;
  PyObject *__pyx_v_rid = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  char *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 1982);
  __Pyx_INCREF((PyObject *)__pyx_v_bcf);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);

  /* "pysam/cbcf.pyx":1983
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):
 *         if not isinstance(bcf.index, TabixIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('tabix index required')
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_5pysam_4cbcf_TabixIndex)); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1984
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef TabixIndex index = bcf.index
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1986
 *             raise ValueError('tabix index required')
 * 
 *         cdef TabixIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         if not index:
 */
  if (!(likely(((((PyObject *)__pyx_v_bcf->index)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_bcf->index), __pyx_ptype_5pysam_4cbcf_TabixIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_index = ((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":1988
 *         cdef TabixIndex index = bcf.index
 * 
 *         if not index:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1989
 * 
 *         if not index:
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":1991
 *             raise ValueError('bcf index required')
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             bcf = bcf.copy()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":1992
 * 
 *         if reopen:
 *             bcf = bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         if region is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bcf), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_4cbcf_VariantFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_bcf, ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysam/cbcf.pyx":1994
 *             bcf = bcf.copy()
 * 
 *         if region is not None:             # <<<<<<<<<<<<<<
 *             if contig is not None or start is not None or stop is not None:
 *                 raise ValueError  # FIXME
 */
  __pyx_t_2 = (__pyx_v_region != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":1995
 * 
 *         if region is not None:
 *             if contig is not None or start is not None or stop is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError  # FIXME
 * 
 */
    __pyx_t_2 = (__pyx_v_contig != Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (!__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_start != Py_None);
    __pyx_t_2 = (__pyx_t_6 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_stop != Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    __pyx_t_3 = __pyx_t_6;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/cbcf.pyx":1996
 *         if region is not None:
 *             if contig is not None or start is not None or stop is not None:
 *                 raise ValueError  # FIXME             # <<<<<<<<<<<<<<
 * 
 *             self.iter = tbx_itr_querys(index.ptr, region)
 */
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":1998
 *                 raise ValueError  # FIXME
 * 
 *             self.iter = tbx_itr_querys(index.ptr, region)             # <<<<<<<<<<<<<<
 *         else:
 *             if contig is None:
 */
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->__pyx_base.iter = tbx_itr_querys(__pyx_v_index->ptr, __pyx_t_7);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":2000
 *             self.iter = tbx_itr_querys(index.ptr, region)
 *         else:
 *             if contig is None:             # <<<<<<<<<<<<<<
 *                 raise ValueError  # FIXME
 * 
 */
    __pyx_t_3 = (__pyx_v_contig == Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "pysam/cbcf.pyx":2001
 *         else:
 *             if contig is None:
 *                 raise ValueError  # FIXME             # <<<<<<<<<<<<<<
 * 
 *             rid = index.refmap.get(contig, -1)
 */
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":2003
 *                 raise ValueError  # FIXME
 * 
 *             rid = index.refmap.get(contig, -1)             # <<<<<<<<<<<<<<
 * 
 *             if start is None:
 */
    if (unlikely(__pyx_v_index->__pyx_base.refmap == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_index->__pyx_base.refmap, __pyx_v_contig, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rid = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysam/cbcf.pyx":2005
 *             rid = index.refmap.get(contig, -1)
 * 
 *             if start is None:             # <<<<<<<<<<<<<<
 *                 start = 0
 *             if stop is None:
 */
    __pyx_t_6 = (__pyx_v_start == Py_None);
    __pyx_t_3 = (__pyx_t_6 != 0);
    if (__pyx_t_3) {

      /* "pysam/cbcf.pyx":2006
 * 
 *             if start is None:
 *                 start = 0             # <<<<<<<<<<<<<<
 *             if stop is None:
 *                 stop = MAX_POS
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_0);
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "pysam/cbcf.pyx":2007
 *             if start is None:
 *                 start = 0
 *             if stop is None:             # <<<<<<<<<<<<<<
 *                 stop = MAX_POS
 * 
 */
    __pyx_t_3 = (__pyx_v_stop == Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "pysam/cbcf.pyx":2008
 *                 start = 0
 *             if stop is None:
 *                 stop = MAX_POS             # <<<<<<<<<<<<<<
 * 
 *             self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
 */
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_5pysam_4cbcf_MAX_POS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "pysam/cbcf.pyx":2010
 *                 stop = MAX_POS
 * 
 *             self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)             # <<<<<<<<<<<<<<
 * 
 *         # Do not fail on self.iter == NULL, since it signifies a null query.
 */
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_rid); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->__pyx_base.iter = tbx_itr_queryi(__pyx_v_index->ptr, __pyx_t_8, __pyx_t_9, __pyx_t_10);
  }
  __pyx_L6:;

  /* "pysam/cbcf.pyx":2014
 *         # Do not fail on self.iter == NULL, since it signifies a null query.
 * 
 *         self.bcf = bcf             # <<<<<<<<<<<<<<
 *         self.index = index
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_bcf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_bcf));
  __Pyx_GOTREF(__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/cbcf.pyx":2015
 * 
 *         self.bcf = bcf
 *         self.index = index             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
  __Pyx_GOTREF(__pyx_v_self->index);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
  __pyx_v_self->index = __pyx_v_index;

  /* "pysam/cbcf.pyx":1982
 *         self.line_buffer.s = NULL
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_rid);
  __Pyx_XDECREF((PyObject *)__pyx_v_bcf);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2017
 *         self.index = index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
 */

/* Python wrapper */
static void __pyx_pw_5pysam_4cbcf_13TabixIterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_13TabixIterator_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_13TabixIterator_4__dealloc__(((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_13TabixIterator_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 2017);

  /* "pysam/cbcf.pyx":2018
 * 
 *     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/cbcf.pyx":2019
 *     def __dealloc__(self):
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 * 
 */
    tbx_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/cbcf.pyx":2020
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 *         if self.line_buffer.m:
 */
    __pyx_v_self->__pyx_base.iter = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":2022
 *             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/cbcf.pyx":2023
 * 
 *         if self.line_buffer.m:
 *             free(self.line_buffer.s)             # <<<<<<<<<<<<<<
 * 
 *         self.line_buffer.l = 0
 */
    free(__pyx_v_self->line_buffer.s);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pysam/cbcf.pyx":2025
 *             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/cbcf.pyx":2026
 * 
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0             # <<<<<<<<<<<<<<
 *         self.line_buffer.s = NULL
 * 
 */
  __pyx_v_self->line_buffer.m = 0;

  /* "pysam/cbcf.pyx":2027
 *         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/cbcf.pyx":2017
 *         self.index = index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
 */

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

/* "pysam/cbcf.pyx":2029
 *         self.line_buffer.s = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13TabixIterator_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13TabixIterator_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13TabixIterator_6__iter__(((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13TabixIterator_6__iter__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2029);

  /* "pysam/cbcf.pyx":2030
 * 
 *     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/cbcf.pyx":2029
 *         self.line_buffer.s = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "pysam/cbcf.pyx":2032
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_13TabixIterator_9__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_13TabixIterator_9__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_13TabixIterator_8__next__(((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_13TabixIterator_8__next__(struct __pyx_obj_5pysam_4cbcf_TabixIterator *__pyx_v_self) {
  int __pyx_v_ret;
  bcf1_t *__pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceCall("__next__", __pyx_f[0], 2032);

  /* "pysam/cbcf.pyx":2033
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_self->__pyx_base.iter != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2034
 *     def __next__(self):
 *         if not self.iter:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2036
 *             raise StopIteration
 * 
 *         cdef int 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->htsfile, __pyx_v_self->index->ptr, __pyx_v_self->__pyx_base.iter, (&__pyx_v_self->line_buffer));

  /* "pysam/cbcf.pyx":2038
 *         cdef int 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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2039
 * 
 *         if ret < 0:
 *             tbx_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 *             if ret == -1:
 */
    tbx_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/cbcf.pyx":2040
 *         if ret < 0:
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
 */
    __pyx_v_self->__pyx_base.iter = NULL;

    /* "pysam/cbcf.pyx":2041
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             else:
 */
    __pyx_t_1 = ((__pyx_v_ret == -1) != 0);
    if (__pyx_t_1) {

      /* "pysam/cbcf.pyx":2042
 *             self.iter = NULL
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('error reading indexed VCF file')
 */
      __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":2044
 *                 raise StopIteration
 *             else:
 *                 raise ValueError('error reading indexed VCF file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__67, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }

  /* "pysam/cbcf.pyx":2046
 *                 raise ValueError('error reading indexed VCF file')
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/cbcf.pyx":2048
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
 */
  __pyx_v_record->pos = -1;

  /* "pysam/cbcf.pyx":2049
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base.bcf->drop_samples != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2050
 *         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;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysam/cbcf.pyx":2052
 *             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/cbcf.pyx":2055
 * 
 *         # 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) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2056
 *         # FIXME: stop iteration on parse failure?
 *         if ret < 0:
 *             bcf_destroy1(record)             # <<<<<<<<<<<<<<
 *             raise ValueError('error in vcf_parse')
 * 
 */
    bcf_destroy1(__pyx_v_record);

    /* "pysam/cbcf.pyx":2057
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2059
 *             raise ValueError('error in vcf_parse')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_2), __pyx_v_record)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2032
 *         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_AddTraceback("pysam.cbcf.TabixIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2097
 *     obtained from another :term:`VCF` file/:term:`BCF` file.
 *     """
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_11VariantFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_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;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : 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_4cbcf_11VariantFile___cinit__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_5pysam_4cbcf_11VariantFile___cinit__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 2097);

  /* "pysam/cbcf.pyx":2098
 *     """
 *     def __cinit__(self, *args, **kwargs):
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, *args, **kwargs):
 */
  __pyx_v_self->htsfile = NULL;

  /* "pysam/cbcf.pyx":2097
 *     obtained from another :term:`VCF` file/:term:`BCF` file.
 *     """
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 * 
 */

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

/* "pysam/cbcf.pyx":2100
 *         self.htsfile = NULL
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.header       = None
 *         self.index        = None
 */

/* Python wrapper */
static int __pyx_pw_5pysam_4cbcf_11VariantFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_4cbcf_11VariantFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : 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_4cbcf_11VariantFile_2__init__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_5pysam_4cbcf_11VariantFile_2__init__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 2100);

  /* "pysam/cbcf.pyx":2101
 * 
 *     def __init__(self, *args, **kwargs):
 *         self.header       = None             # <<<<<<<<<<<<<<
 *         self.index        = None
 *         self.filename     = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->header));
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None);

  /* "pysam/cbcf.pyx":2102
 *     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(__pyx_v_self->index);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
  __pyx_v_self->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None);

  /* "pysam/cbcf.pyx":2103
 *         self.header       = None
 *         self.index        = None
 *         self.filename     = None             # <<<<<<<<<<<<<<
 *         self.mode         = None
 *         self.is_stream    = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->filename);
  __Pyx_DECREF(__pyx_v_self->filename);
  __pyx_v_self->filename = Py_None;

  /* "pysam/cbcf.pyx":2104
 *         self.index        = None
 *         self.filename     = None
 *         self.mode         = None             # <<<<<<<<<<<<<<
 *         self.is_stream    = False
 *         self.is_remote    = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->mode);
  __Pyx_DECREF(__pyx_v_self->mode);
  __pyx_v_self->mode = Py_None;

  /* "pysam/cbcf.pyx":2105
 *         self.filename     = None
 *         self.mode         = None
 *         self.is_stream    = False             # <<<<<<<<<<<<<<
 *         self.is_remote    = False
 *         self.is_reading   = False
 */
  __pyx_v_self->is_stream = 0;

  /* "pysam/cbcf.pyx":2106
 *         self.mode         = None
 *         self.is_stream    = False
 *         self.is_remote    = False             # <<<<<<<<<<<<<<
 *         self.is_reading   = False
 *         self.drop_samples = False
 */
  __pyx_v_self->is_remote = 0;

  /* "pysam/cbcf.pyx":2107
 *         self.is_stream    = False
 *         self.is_remote    = False
 *         self.is_reading   = False             # <<<<<<<<<<<<<<
 *         self.drop_samples = False
 *         self.start_offset = -1
 */
  __pyx_v_self->is_reading = 0;

  /* "pysam/cbcf.pyx":2108
 *         self.is_remote    = False
 *         self.is_reading   = False
 *         self.drop_samples = False             # <<<<<<<<<<<<<<
 *         self.start_offset = -1
 * 
 */
  __pyx_v_self->drop_samples = 0;

  /* "pysam/cbcf.pyx":2109
 *         self.is_reading   = False
 *         self.drop_samples = False
 *         self.start_offset = -1             # <<<<<<<<<<<<<<
 * 
 *         self.open(*args, **kwargs)
 */
  __pyx_v_self->start_offset = -1;

  /* "pysam/cbcf.pyx":2111
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/cbcf.pyx":2100
 *         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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2113
 *         self.open(*args, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.htsfile:
 *             hts_close(self.htsfile)
 */

/* Python wrapper */
static void __pyx_pw_5pysam_4cbcf_11VariantFile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_4cbcf_11VariantFile_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5pysam_4cbcf_11VariantFile_4__dealloc__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static void __pyx_pf_5pysam_4cbcf_11VariantFile_4__dealloc__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 2113);

  /* "pysam/cbcf.pyx":2114
 * 
 *     def __dealloc__(self):
 *         if self.htsfile:             # <<<<<<<<<<<<<<
 *             hts_close(self.htsfile)
 *             self.htsfile = NULL
 */
  __pyx_t_1 = (__pyx_v_self->htsfile != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2115
 *     def __dealloc__(self):
 *         if self.htsfile:
 *             hts_close(self.htsfile)             # <<<<<<<<<<<<<<
 *             self.htsfile = NULL
 * 
 */
    hts_close(__pyx_v_self->htsfile);

    /* "pysam/cbcf.pyx":2116
 *         if self.htsfile:
 *             hts_close(self.htsfile)
 *             self.htsfile = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
    __pyx_v_self->htsfile = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":2113
 *         self.open(*args, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.htsfile:
 *             hts_close(self.htsfile)
 */

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

/* "pysam/cbcf.pyx":2118
 *             self.htsfile = NULL
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_6__enter__[] = "VariantFile.__enter__(self)";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_6__enter__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6__enter__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);
  __Pyx_TraceCall("__enter__", __pyx_f[0], 2118);

  /* "pysam/cbcf.pyx":2119
 * 
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2118
 *             self.htsfile = NULL
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "pysam/cbcf.pyx":2121
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_8__exit__[] = "VariantFile.__exit__(self, exc_type, exc_value, traceback)";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_value,&__pyx_n_s_traceback,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_value = values[1];
    __pyx_v_traceback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_8__exit__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8__exit__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__exit__", 0);
  __Pyx_TraceCall("__exit__", __pyx_f[0], 2121);

  /* "pysam/cbcf.pyx":2122
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):
 *         self.close()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2123
 *     def __exit__(self, exc_type, exc_value, traceback):
 *         self.close()
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     property category:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2121
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 *         return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2127
 *     property category:
 *         """General file format category.  One of UNKNOWN, ALIGNMENTS, VARIANTS, INDEX, REGIONS"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_8category_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_8category_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_8category___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8category___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2127);

  /* "pysam/cbcf.pyx":2128
 *         """General file format category.  One of UNKNOWN, ALIGNMENTS, VARIANTS, INDEX, REGIONS"""
 *         def __get__(self):
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError('metadata not available on closed file')
 *             return FORMAT_CATEGORIES[self.htsfile.format.category]
 */
  __pyx_t_1 = ((!(__pyx_v_self->htsfile != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2129
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return FORMAT_CATEGORIES[self.htsfile.format.category]
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__69, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2130
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 *             return FORMAT_CATEGORIES[self.htsfile.format.category]             # <<<<<<<<<<<<<<
 * 
 *     property format:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->htsfile->format.category); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetItem(__pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES, __pyx_t_2); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2127
 *     property category:
 *         """General file format category.  One of UNKNOWN, ALIGNMENTS, VARIANTS, INDEX, REGIONS"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.category.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2136
 *            One of UNKNOWN, BINARY_FORMAT, TEXT_FORMAT, SAM, BAM, BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6format_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_6format___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6format___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2136);

  /* "pysam/cbcf.pyx":2137
 *         """
 *         def __get__(self):
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError('metadata not available on closed file')
 *             return FORMATS[self.htsfile.format.format]
 */
  __pyx_t_1 = ((!(__pyx_v_self->htsfile != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2138
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return FORMATS[self.htsfile.format.format]
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2139
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 *             return FORMATS[self.htsfile.format.format]             # <<<<<<<<<<<<<<
 * 
 *     property version:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_4cbcf_FORMATS == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->htsfile->format.format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetItem(__pyx_v_5pysam_4cbcf_FORMATS, __pyx_t_2); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2136
 *            One of UNKNOWN, BINARY_FORMAT, TEXT_FORMAT, SAM, BAM, BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2143
 *     property version:
 *         """Tuple of file format version numbers (major, minor)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_7version___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_7version___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2143);

  /* "pysam/cbcf.pyx":2144
 *         """Tuple of file format version numbers (major, minor)"""
 *         def __get__(self):
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError('metadata not available on closed file')
 *             return self.htsfile.format.version.major, self.htsfile.format.version.minor
 */
  __pyx_t_1 = ((!(__pyx_v_self->htsfile != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2145
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return self.htsfile.format.version.major, self.htsfile.format.version.minor
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2146
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 *             return self.htsfile.format.version.major, self.htsfile.format.version.minor             # <<<<<<<<<<<<<<
 * 
 *     property compression:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->htsfile->format.version.major); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_short(__pyx_v_self->htsfile->format.version.minor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2143
 *     property version:
 *         """Tuple of file format version numbers (major, minor)"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2150
 *     property compression:
 *         """File compression.  One of NONE, GZIP, BGZF, CUSTOM."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11compression_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11compression_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_11compression___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_11compression___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2150);

  /* "pysam/cbcf.pyx":2151
 *         """File compression.  One of NONE, GZIP, BGZF, CUSTOM."""
 *         def __get__(self):
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError('metadata not available on closed file')
 *             return COMPRESSION[self.htsfile.format.compression]
 */
  __pyx_t_1 = ((!(__pyx_v_self->htsfile != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2152
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return COMPRESSION[self.htsfile.format.compression]
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2153
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 *             return COMPRESSION[self.htsfile.format.compression]             # <<<<<<<<<<<<<<
 * 
 *     property description:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_4cbcf_COMPRESSION == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->htsfile->format.compression); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetItem(__pyx_v_5pysam_4cbcf_COMPRESSION, __pyx_t_2); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2150
 *     property compression:
 *         """File compression.  One of NONE, GZIP, BGZF, CUSTOM."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.compression.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2157
 *     property description:
 *         """Vaguely human readable description of the file format"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11description_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_11description___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_11description___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  char *__pyx_v_desc;
  PyObject *__pyx_r = NULL;
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2157);

  /* "pysam/cbcf.pyx":2158
 *         """Vaguely human readable description of the file format"""
 *         def __get__(self):
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError('metadata not available on closed file')
 *             cdef char *desc = hts_format_description(&self.htsfile.format)
 */
  __pyx_t_1 = ((!(__pyx_v_self->htsfile != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2159
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             cdef char *desc = hts_format_description(&self.htsfile.format)
 *             try:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2160
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 *             cdef char *desc = hts_format_description(&self.htsfile.format)             # <<<<<<<<<<<<<<
 *             try:
 *                 return force_str(desc)
 */
  __pyx_v_desc = hts_format_description((&__pyx_v_self->htsfile->format));

  /* "pysam/cbcf.pyx":2161
 *                 raise ValueError('metadata not available on closed file')
 *             cdef char *desc = hts_format_description(&self.htsfile.format)
 *             try:             # <<<<<<<<<<<<<<
 *                 return force_str(desc)
 *             finally:
 */
  /*try:*/ {

    /* "pysam/cbcf.pyx":2162
 *             cdef char *desc = hts_format_description(&self.htsfile.format)
 *             try:
 *                 return force_str(desc)             # <<<<<<<<<<<<<<
 *             finally:
 *                 free(desc)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_desc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_5pysam_4cbcf_force_str(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L5_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_L4_return;
  }

  /* "pysam/cbcf.pyx":2164
 *                 return force_str(desc)
 *             finally:
 *                 free(desc)             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L5_error:;
      __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;
      {
        free(__pyx_v_desc);
      }
      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_12 = __pyx_r;
      __pyx_r = 0;
      free(__pyx_v_desc);
      __pyx_r = __pyx_t_12;
      __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "pysam/cbcf.pyx":2157
 *     property description:
 *         """Vaguely human readable description of the file format"""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2166
 *                 free(desc)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if self.htsfile:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_10close[] = "VariantFile.close(self)\ncloses the :class:`pysam.VariantFile`.";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_10close(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_10close(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("close", 0);
  __Pyx_TraceCall("close", __pyx_f[0], 2166);

  /* "pysam/cbcf.pyx":2168
 *     def close(self):
 *         """closes the :class:`pysam.VariantFile`."""
 *         if self.htsfile:             # <<<<<<<<<<<<<<
 *             hts_close(self.htsfile)
 *             self.htsfile = NULL
 */
  __pyx_t_1 = (__pyx_v_self->htsfile != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2169
 *         """closes the :class:`pysam.VariantFile`."""
 *         if self.htsfile:
 *             hts_close(self.htsfile)             # <<<<<<<<<<<<<<
 *             self.htsfile = NULL
 *         self.header = self.index = None
 */
    hts_close(__pyx_v_self->htsfile);

    /* "pysam/cbcf.pyx":2170
 *         if self.htsfile:
 *             hts_close(self.htsfile)
 *             self.htsfile = NULL             # <<<<<<<<<<<<<<
 *         self.header = self.index = None
 * 
 */
    __pyx_v_self->htsfile = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":2171
 *             hts_close(self.htsfile)
 *             self.htsfile = NULL
 *         self.header = self.index = None             # <<<<<<<<<<<<<<
 * 
 *     property is_open:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->header));
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->index);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
  __pyx_v_self->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None);

  /* "pysam/cbcf.pyx":2166
 *                 free(desc)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if self.htsfile:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2174
 * 
 *     property is_open:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             """return True if VariantFile is open and in a valid state."""
 *             return self.htsfile != NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7is_open_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_7is_open_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_7is_open___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_7is_open___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 2174);

  /* "pysam/cbcf.pyx":2176
 *         def __get__(self):
 *             """return True if VariantFile is open and in a valid state."""
 *             return self.htsfile != NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->htsfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2174
 * 
 *     property is_open:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             """return True if VariantFile is open and in a valid state."""
 *             return self.htsfile != NULL
 */

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

/* "pysam/cbcf.pyx":2178
 *             return self.htsfile != NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_13__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_13__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_12__iter__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_12__iter__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 2178);

  /* "pysam/cbcf.pyx":2179
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2180
 *     def __iter__(self):
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2182
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.mode[0] != b'r':             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_r, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2183
 * 
 *         if self.mode[0] != b'r':
 *             raise ValueError('cannot iterate over Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__75, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2185
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
 *         self.is_reading = 1             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->is_reading = 1;

  /* "pysam/cbcf.pyx":2186
 * 
 *         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/cbcf.pyx":2178
 *             return self.htsfile != NULL
 * 
 *     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.cbcf.VariantFile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2188
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef bcf1_t *record = bcf_init1()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_15__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_15__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_14__next__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_14__next__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  int __pyx_v_ret;
  bcf1_t *__pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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_TraceDeclarations
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceCall("__next__", __pyx_f[0], 2188);

  /* "pysam/cbcf.pyx":2190
 *     def __next__(self):
 *         cdef int ret
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
 */
  __pyx_v_record = bcf_init1();

  /* "pysam/cbcf.pyx":2192
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
 */
  __pyx_v_record->pos = -1;

  /* "pysam/cbcf.pyx":2193
 * 
 *         record.pos = -1
 *         if self.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
 */
  __pyx_t_1 = (__pyx_v_self->drop_samples != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2194
 *         record.pos = -1
 *         if self.drop_samples:
 *             record.max_unpack = BCF_UN_SHR             # <<<<<<<<<<<<<<
 * 
 *         ret = bcf_read1(self.htsfile, self.header.ptr, record)
 */
    __pyx_v_record->max_unpack = BCF_UN_SHR;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":2196
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         ret = bcf_read1(self.htsfile, self.header.ptr, record)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
 */
  __pyx_v_ret = bcf_read1(__pyx_v_self->htsfile, __pyx_v_self->header->ptr, __pyx_v_record);

  /* "pysam/cbcf.pyx":2198
 *         ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             if ret == -1:
 */
  __pyx_t_1 = ((__pyx_v_ret < 0) != 0);
  if (__pyx_t_1) {

    /* "pysam/cbcf.pyx":2199
 * 
 *         if ret < 0:
 *             bcf_destroy1(record)             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
 */
    bcf_destroy1(__pyx_v_record);

    /* "pysam/cbcf.pyx":2202
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             else:
 */
    switch (__pyx_v_ret) {

      /* "pysam/cbcf.pyx":2200
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
 */
      case -1:

      /* "pysam/cbcf.pyx":2201
 *             bcf_destroy1(record)
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 */
      __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;

      /* "pysam/cbcf.pyx":2202
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             else:
 */
      case -2:

      /* "pysam/cbcf.pyx":2203
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('Variant read failed')
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
      default:

      /* "pysam/cbcf.pyx":2205
 *                 raise IOError('truncated file')
 *             else:
 *                 raise ValueError('Variant read failed')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.header, record)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
  }

  /* "pysam/cbcf.pyx":2207
 *                 raise ValueError('Variant read failed')
 * 
 *         return makeVariantRecord(self.header, record)             # <<<<<<<<<<<<<<
 * 
 *     def copy(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_4cbcf_makeVariantRecord(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_2), __pyx_v_record)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __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/cbcf.pyx":2188
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef bcf1_t *record = bcf_init1()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2209
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_17copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_16copy[] = "VariantFile.copy(self)";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_17copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_16copy(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_16copy(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_vars = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  char const *__pyx_t_5;
  int64_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_TraceCall("copy", __pyx_f[0], 2209);

  /* "pysam/cbcf.pyx":2210
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2211
 *     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_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2213
 *             raise ValueError
 * 
 *         cdef VariantFile vars = VariantFile.__new__(VariantFile)             # <<<<<<<<<<<<<<
 * 
 *         # FIXME: re-open using fd or else header and index could be invalid
 */
  __pyx_t_1 = __pyx_tp_new_5pysam_4cbcf_VariantFile(((PyTypeObject *)((PyObject*)__pyx_ptype_5pysam_4cbcf_VariantFile)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_4cbcf_VariantFile)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_vars = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2216
 * 
 *         # FIXME: re-open using fd or else header and index could be invalid
 *         vars.htsfile = hts_open(self.filename, self.mode)             # <<<<<<<<<<<<<<
 * 
 *         if not vars.htsfile:
 */
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_self->filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_self->mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_vars->htsfile = hts_open(__pyx_t_4, __pyx_t_5);

  /* "pysam/cbcf.pyx":2218
 *         vars.htsfile = hts_open(self.filename, self.mode)
 * 
 *         if not vars.htsfile:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot re-open htsfile')
 * 
 */
  __pyx_t_3 = ((!(__pyx_v_vars->htsfile != 0)) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2219
 * 
 *         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__78, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2223
 *         # 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(__pyx_v_vars->header);
  __Pyx_DECREF(((PyObject *)__pyx_v_vars->header));
  __pyx_v_vars->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2224
 *         # 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(__pyx_v_vars->index);
  __Pyx_DECREF(((PyObject *)__pyx_v_vars->index));
  __pyx_v_vars->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2226
 *         vars.index        = self.index
 * 
 *         vars.filename     = self.filename             # <<<<<<<<<<<<<<
 *         vars.mode         = self.mode
 *         vars.drop_samples = self.drop_samples
 */
  __pyx_t_1 = __pyx_v_self->filename;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->filename);
  __Pyx_DECREF(__pyx_v_vars->filename);
  __pyx_v_vars->filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2227
 * 
 *         vars.filename     = self.filename
 *         vars.mode         = self.mode             # <<<<<<<<<<<<<<
 *         vars.drop_samples = self.drop_samples
 *         vars.is_stream    = self.is_stream
 */
  __pyx_t_1 = __pyx_v_self->mode;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->mode);
  __Pyx_DECREF(__pyx_v_vars->mode);
  __pyx_v_vars->mode = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2228
 *         vars.filename     = self.filename
 *         vars.mode         = self.mode
 *         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/cbcf.pyx":2229
 *         vars.mode         = self.mode
 *         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->is_stream;
  __pyx_v_vars->is_stream = __pyx_t_3;

  /* "pysam/cbcf.pyx":2230
 *         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->is_remote;
  __pyx_v_vars->is_remote = __pyx_t_3;

  /* "pysam/cbcf.pyx":2231
 *         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->is_reading;
  __pyx_v_vars->is_reading = __pyx_t_3;

  /* "pysam/cbcf.pyx":2232
 *         vars.is_remote    = self.is_remote
 *         vars.is_reading   = self.is_reading
 *         vars.start_offset = self.start_offset             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_bin:
 */
  __pyx_t_6 = __pyx_v_self->start_offset;
  __pyx_v_vars->start_offset = __pyx_t_6;

  /* "pysam/cbcf.pyx":2234
 *         vars.start_offset = self.start_offset
 * 
 *         if self.htsfile.is_bin:             # <<<<<<<<<<<<<<
 *             vars.seek(self.tell())
 *         else:
 */
  __pyx_t_3 = (__pyx_v_self->htsfile->is_bin != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2235
 * 
 *         if self.htsfile.is_bin:
 *             vars.seek(self.tell())             # <<<<<<<<<<<<<<
 *         else:
 *             makeVariantHeader(bcf_hdr_read(vars.htsfile))
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vars), __pyx_n_s_seek); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (__pyx_t_10) {
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":2237
 *             vars.seek(self.tell())
 *         else:
 *             makeVariantHeader(bcf_hdr_read(vars.htsfile))             # <<<<<<<<<<<<<<
 * 
 *         return vars
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeader(bcf_hdr_read(__pyx_v_vars->htsfile))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "pysam/cbcf.pyx":2239
 *             makeVariantHeader(bcf_hdr_read(vars.htsfile))
 * 
 *         return vars             # <<<<<<<<<<<<<<
 * 
 *     def open(self, filename, mode=None, VariantHeader header=None, drop_samples=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vars));
  __pyx_r = ((PyObject *)__pyx_v_vars);
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2209
 *         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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysam.cbcf.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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2241
 *         return vars
 * 
 *     def open(self, filename, mode=None, VariantHeader header=None, drop_samples=False):             # <<<<<<<<<<<<<<
 *         """open a vcf/bcf file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_19open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_18open[] = "VariantFile.open(self, filename, mode=None, VariantHeader header=None, drop_samples=False)\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 PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_19open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header = 0;
  PyObject *__pyx_v_drop_samples = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,&__pyx_n_s_header,&__pyx_n_s_drop_samples,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = (PyObject *)((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None);
    values[3] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_header);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_drop_samples);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)values[2]);
    __pyx_v_drop_samples = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("open", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.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_4cbcf_VariantHeader, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_18open(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_header, __pyx_v_drop_samples);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_18open(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_5pysam_4cbcf_VariantHeader *__pyx_v_header, PyObject *__pyx_v_drop_samples) {
  CYTHON_UNUSED PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  char const *__pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  char const *__pyx_t_15;
  char *__pyx_t_16;
  int64_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("open", 0);
  __Pyx_TraceCall("open", __pyx_f[0], 2241);
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_mode);

  /* "pysam/cbcf.pyx":2248
 *         """
 *         # close a previously opened file
 *         if self.is_open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2249
 *         # close a previously opened file
 *         if self.is_open:
 *             self.close()             # <<<<<<<<<<<<<<
 * 
 *         # read mode autodetection
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":2252
 * 
 *         # read mode autodetection
 *         if mode is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.open(filename, 'rb', header=header)
 */
  __pyx_t_2 = (__pyx_v_mode == Py_None);
  __pyx_t_5 = (__pyx_t_2 != 0);
  if (__pyx_t_5) {

    /* "pysam/cbcf.pyx":2253
 *         # read mode autodetection
 *         if mode is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.open(filename, 'rb', header=header)
 *                 return
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "pysam/cbcf.pyx":2254
 *         if mode is None:
 *             try:
 *                 self.open(filename, 'rb', header=header)             # <<<<<<<<<<<<<<
 *                 return
 *             except ValueError, msg:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __Pyx_INCREF(__pyx_n_s_rb);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_rb);
        __Pyx_GIVEREF(__pyx_n_s_rb);
        __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_header, ((PyObject *)__pyx_v_header)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "pysam/cbcf.pyx":2255
 *             try:
 *                 self.open(filename, 'rb', header=header)
 *                 return             # <<<<<<<<<<<<<<
 *             except ValueError, msg:
 *                 pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L9_try_return;
      }
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pysam/cbcf.pyx":2256
 *                 self.open(filename, 'rb', header=header)
 *                 return
 *             except ValueError, msg:             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
      __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_10) {
        __Pyx_AddTraceback("pysam.cbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_msg = __pyx_t_4;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L9_try_return:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L0;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    }

    /* "pysam/cbcf.pyx":2259
 *                 pass
 * 
 *             self.open(filename, 'r', header=header)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __Pyx_INCREF(__pyx_n_s_r);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_r);
    __Pyx_GIVEREF(__pyx_n_s_r);
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_header, ((PyObject *)__pyx_v_header)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/cbcf.pyx":2260
 * 
 *             self.open(filename, 'r', header=header)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if mode not in ('r','w','rb','wb', 'wh', 'wbu', 'rU', 'wb0'):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":2262
 *             return
 * 
 *         if mode not in ('r','w','rb','wb', 'wh', 'wbu', 'rU', 'wb0'):             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid file opening mode `{}`'.format(mode))
 * 
 */
  __Pyx_INCREF(__pyx_v_mode);
  __pyx_t_1 = __pyx_v_mode;
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_r, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_w, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_rb, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_wb, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_wh, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_wbu, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_rU, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_5 = __pyx_t_2;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_wb0, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_t_2;
  __pyx_L16_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_5 != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2263
 * 
 *         if mode not in ('r','w','rb','wb', 'wh', 'wbu', 'rU', 'wb0'):
 *             raise ValueError('invalid file opening mode `{}`'.format(mode))             # <<<<<<<<<<<<<<
 * 
 *         mode = mode.encode('ascii')
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_invalid_file_opening_mode, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2265
 *             raise ValueError('invalid file opening mode `{}`'.format(mode))
 * 
 *         mode = mode.encode('ascii')             # <<<<<<<<<<<<<<
 * 
 *         # for htslib, wbu seems to not work
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mode, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__79, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_9);
  __pyx_t_9 = 0;

  /* "pysam/cbcf.pyx":2268
 * 
 *         # for htslib, wbu seems to not work
 *         if mode == b'wbu':             # <<<<<<<<<<<<<<
 *             mode = b'wb0'
 * 
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_mode, __pyx_n_b_wbu, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2269
 *         # for htslib, wbu seems to not work
 *         if mode == b'wbu':
 *             mode = b'wb0'             # <<<<<<<<<<<<<<
 * 
 *         self.mode = mode
 */
    __Pyx_INCREF(__pyx_n_b_wb0);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_b_wb0);
    goto __pyx_L24;
  }
  __pyx_L24:;

  /* "pysam/cbcf.pyx":2271
 *             mode = b'wb0'
 * 
 *         self.mode = mode             # <<<<<<<<<<<<<<
 *         self.filename = filename = encode_filename(filename)
 *         self.drop_samples = bool(drop_samples)
 */
  __Pyx_INCREF(__pyx_v_mode);
  __Pyx_GIVEREF(__pyx_v_mode);
  __Pyx_GOTREF(__pyx_v_self->mode);
  __Pyx_DECREF(__pyx_v_self->mode);
  __pyx_v_self->mode = __pyx_v_mode;

  /* "pysam/cbcf.pyx":2272
 * 
 *         self.mode = mode
 *         self.filename = filename = encode_filename(filename)             # <<<<<<<<<<<<<<
 *         self.drop_samples = bool(drop_samples)
 * 
 */
  __pyx_t_9 = __pyx_f_5pysam_4cbcf_encode_filename(__pyx_v_filename); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(__pyx_v_self->filename);
  __Pyx_DECREF(__pyx_v_self->filename);
  __pyx_v_self->filename = __pyx_t_9;
  __Pyx_INCREF(__pyx_t_9);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_9);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pysam/cbcf.pyx":2273
 *         self.mode = mode
 *         self.filename = filename = encode_filename(filename)
 *         self.drop_samples = bool(drop_samples)             # <<<<<<<<<<<<<<
 * 
 *         # FIXME: Use htsFormat when it is available
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_drop_samples); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->drop_samples = (!(!__pyx_t_2));

  /* "pysam/cbcf.pyx":2276
 * 
 *         # FIXME: Use htsFormat when it is available
 *         self.is_remote = filename.startswith(b'http:') or filename.startswith(b'ftp:')             # <<<<<<<<<<<<<<
 *         self.is_stream = filename == b'-'
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_startswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_2 = __pyx_t_5;
  __pyx_L25_bool_binop_done:;
  __pyx_v_self->is_remote = __pyx_t_2;

  /* "pysam/cbcf.pyx":2277
 *         # FIXME: Use htsFormat when it is available
 *         self.is_remote = filename.startswith(b'http:') or filename.startswith(b'ftp:')
 *         self.is_stream = filename == b'-'             # <<<<<<<<<<<<<<
 * 
 *         if mode[0] == b'w':
 */
  __pyx_t_9 = PyObject_RichCompare(__pyx_v_filename, __pyx_kp_b__82, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_self->is_stream = __pyx_t_2;

  /* "pysam/cbcf.pyx":2279
 *         self.is_stream = filename == b'-'
 * 
 *         if mode[0] == b'w':             # <<<<<<<<<<<<<<
 *             # open file for writing
 * 
 */
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_9, __pyx_n_b_w, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2283
 * 
 *             # header structure (used for writing)
 *             if header:             # <<<<<<<<<<<<<<
 *                 self.header = header.copy()
 *             else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":2284
 *             # header structure (used for writing)
 *             if header:
 *                 self.header = header.copy()             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('a VariantHeader must be specified')
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_header), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5pysam_4cbcf_VariantHeader))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_v_self->header);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->header));
      __pyx_v_self->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_9);
      __pyx_t_9 = 0;
      goto __pyx_L28;
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":2286
 *                 self.header = header.copy()
 *             else:
 *                 raise ValueError('a VariantHeader must be specified')             # <<<<<<<<<<<<<<
 * 
 *             # open file. Header gets written to file at the same time for bam files
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L28:;

    /* "pysam/cbcf.pyx":2290
 *             # open file. Header gets written to file at the same time for bam files
 *             # and sam files (in the latter case, the mode needs to be wh)
 *             self.htsfile = hts_open(filename, mode)             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
 */
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->htsfile = hts_open(__pyx_t_11, __pyx_t_12);

    /* "pysam/cbcf.pyx":2292
 *             self.htsfile = hts_open(filename, mode)
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError("could not open file `{}` (mode='{}')".format((filename, mode)))
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_self->htsfile != 0)) != 0);
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":2293
 * 
 *             if not self.htsfile:
 *                 raise ValueError("could not open file `{}` (mode='{}')".format((filename, mode)))             # <<<<<<<<<<<<<<
 * 
 *             bcf_hdr_write(self.htsfile, self.header.ptr)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_could_not_open_file_mode, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":2295
 *                 raise ValueError("could not open file `{}` (mode='{}')".format((filename, mode)))
 * 
 *             bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *         elif mode[0] == b'r':
 */
    bcf_hdr_write(__pyx_v_self->htsfile, __pyx_v_self->header->ptr);
    goto __pyx_L27;
  }

  /* "pysam/cbcf.pyx":2297
 *             bcf_hdr_write(self.htsfile, self.header.ptr)
 * 
 *         elif mode[0] == b'r':             # <<<<<<<<<<<<<<
 *             # open file for reading
 *             if filename != b'-' and not self.is_remote and not os.path.exists(filename):
 */
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_9, __pyx_n_b_r, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2299
 *         elif mode[0] == b'r':
 *             # open file for reading
 *             if filename != b'-' and not self.is_remote and not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise IOError('file `{}` not found'.format(filename))
 * 
 */
    __pyx_t_5 = (__Pyx_PyBytes_Equals(__pyx_v_filename, __pyx_kp_b__82, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_5 = ((!(__pyx_v_self->is_remote != 0)) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_2 = __pyx_t_5;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_13) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_filename); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL;
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_14 = ((!__pyx_t_5) != 0);
    __pyx_t_2 = __pyx_t_14;
    __pyx_L31_bool_binop_done:;
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":2300
 *             # open file for reading
 *             if filename != b'-' and not self.is_remote and not os.path.exists(filename):
 *                 raise IOError('file `{}` not found'.format(filename))             # <<<<<<<<<<<<<<
 * 
 *             self.htsfile = hts_open(filename, mode)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_file_not_found, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_filename); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":2302
 *                 raise IOError('file `{}` not found'.format(filename))
 * 
 *             self.htsfile = hts_open(filename, mode)             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
 */
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->htsfile = hts_open(__pyx_t_11, __pyx_t_12);

    /* "pysam/cbcf.pyx":2304
 *             self.htsfile = hts_open(filename, mode)
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError("could not open file `{}` (mode='{}') - is it VCF/BCF format?".format((filename, mode)))
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_self->htsfile != 0)) != 0);
    if (__pyx_t_2) {

      /* "pysam/cbcf.pyx":2305
 * 
 *             if not self.htsfile:
 *                 raise ValueError("could not open file `{}` (mode='{}') - is it VCF/BCF format?".format((filename, mode)))             # <<<<<<<<<<<<<<
 * 
 *             self.header = makeVariantHeader(bcf_hdr_read(self.htsfile))
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_could_not_open_file_mode_is_it_V, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":2307
 *                 raise ValueError("could not open file `{}` (mode='{}') - is it VCF/BCF format?".format((filename, mode)))
 * 
 *             self.header = makeVariantHeader(bcf_hdr_read(self.htsfile))             # <<<<<<<<<<<<<<
 * 
 *             if not self.header:
 */
    __pyx_t_9 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeVariantHeader(bcf_hdr_read(__pyx_v_self->htsfile))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_GOTREF(__pyx_v_self->header);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->header));
    __pyx_v_self->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "pysam/cbcf.pyx":2309
 *             self.header = makeVariantHeader(bcf_hdr_read(self.htsfile))
 * 
 *             if not self.header:             # <<<<<<<<<<<<<<
 *                 raise ValueError("file `{}` does not have valid header (mode='{}') - is it BCF format?".format((filename, mode)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->header)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = ((!__pyx_t_2) != 0);
    if (__pyx_t_14) {

      /* "pysam/cbcf.pyx":2310
 * 
 *             if not self.header:
 *                 raise ValueError("file `{}` does not have valid header (mode='{}') - is it BCF format?".format((filename, mode)))             # <<<<<<<<<<<<<<
 * 
 *             # check for index and open if present
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_file_does_not_have_valid_header, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_13 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_13) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL;
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "pysam/cbcf.pyx":2313
 * 
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf:             # <<<<<<<<<<<<<<
 *                 self.index = makeBCFIndex(self.header, bcf_index_load(filename))
 *             else:
 */
    __pyx_t_14 = ((__pyx_v_self->htsfile->format.format == bcf) != 0);
    if (__pyx_t_14) {

      /* "pysam/cbcf.pyx":2314
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf:
 *                 self.index = makeBCFIndex(self.header, bcf_index_load(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 self.index = makeTabixIndex(tbx_index_load(filename + '.tbi'))
 */
      __pyx_t_9 = ((PyObject *)__pyx_v_self->header);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeBCFIndex(((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)__pyx_t_9), bcf_index_load(__pyx_t_15))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->index);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
      __pyx_v_self->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L36;
    }
    /*else*/ {

      /* "pysam/cbcf.pyx":2316
 *                 self.index = makeBCFIndex(self.header, bcf_index_load(filename))
 *             else:
 *                 self.index = makeTabixIndex(tbx_index_load(filename + '.tbi'))             # <<<<<<<<<<<<<<
 * 
 *             if not self.is_stream:
 */
      __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_tbi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_16 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((PyObject *)__pyx_f_5pysam_4cbcf_makeTabixIndex(tbx_index_load(__pyx_t_16))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_v_self->index);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->index));
      __pyx_v_self->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)__pyx_t_9);
      __pyx_t_9 = 0;
    }
    __pyx_L36:;

    /* "pysam/cbcf.pyx":2318
 *                 self.index = makeTabixIndex(tbx_index_load(filename + '.tbi'))
 * 
 *             if not self.is_stream:             # <<<<<<<<<<<<<<
 *                 self.start_offset = self.tell()
 * 
 */
    __pyx_t_14 = ((!(__pyx_v_self->is_stream != 0)) != 0);
    if (__pyx_t_14) {

      /* "pysam/cbcf.pyx":2319
 * 
 *             if not self.is_stream:
 *                 self.start_offset = self.tell()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = __Pyx_PyInt_As_int64_t(__pyx_t_9); if (unlikely((__pyx_t_17 == (int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_self->start_offset = __pyx_t_17;
      goto __pyx_L37;
    }
    __pyx_L37:;
    goto __pyx_L27;
  }
  __pyx_L27:;

  /* "pysam/cbcf.pyx":2241
 *         return vars
 * 
 *     def open(self, filename, mode=None, VariantHeader header=None, drop_samples=False):             # <<<<<<<<<<<<<<
 *         """open a vcf/bcf file.
 * 
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2321
 *                 self.start_offset = self.tell()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset, 0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_21reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_20reset[] = "VariantFile.reset(self)\nreset file position to beginning of file just after the header.";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_21reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_20reset(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_20reset(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_TraceCall("reset", __pyx_f[0], 2321);

  /* "pysam/cbcf.pyx":2323
 *     def reset(self):
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset, 0)             # <<<<<<<<<<<<<<
 * 
 *     def seek(self, uint64_t offset):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->start_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2321
 *                 self.start_offset = self.tell()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2325
 *         return self.seek(self.start_offset, 0)
 * 
 *     def seek(self, uint64_t offset):             # <<<<<<<<<<<<<<
 *         """move file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`."""
 *         if not self.is_open:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_23seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_offset); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_22seek[] = "VariantFile.seek(self, uint64_t offset)\nmove file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`.";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_23seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_offset) {
  uint64_t __pyx_v_offset;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seek (wrapper)", 0);
  assert(__pyx_arg_offset); {
    __pyx_v_offset = __Pyx_PyInt_As_uint64_t(__pyx_arg_offset); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_22seek(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), ((uint64_t)__pyx_v_offset));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_22seek(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, uint64_t __pyx_v_offset) {
  PyObject *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("seek", 0);
  __Pyx_TraceCall("seek", __pyx_f[0], 2325);

  /* "pysam/cbcf.pyx":2327
 *     def seek(self, uint64_t offset):
 *         """move file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`."""
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2328
 *         """move file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`."""
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 *         if self.is_stream:
 *             raise OSError('seek not available in streams')
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2329
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:             # <<<<<<<<<<<<<<
 *             raise OSError('seek not available in streams')
 * 
 */
  __pyx_t_3 = (__pyx_v_self->is_stream != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2330
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 *             raise OSError('seek not available in streams')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.format.compression != no_compression:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2332
 *             raise OSError('seek not available in streams')
 * 
 *         if self.htsfile.format.compression != no_compression:             # <<<<<<<<<<<<<<
 *             return bgzf_seek(hts_get_bgzfp(self.htsfile), offset, SEEK_SET)
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_self->htsfile->format.compression != no_compression) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2333
 * 
 *         if self.htsfile.format.compression != no_compression:
 *             return bgzf_seek(hts_get_bgzfp(self.htsfile), offset, SEEK_SET)             # <<<<<<<<<<<<<<
 *         else:
 *             return hts_useek(self.htsfile, offset, SEEK_SET)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_int64_t(bgzf_seek(hts_get_bgzfp(__pyx_v_self->htsfile), __pyx_v_offset, SEEK_SET)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":2335
 *             return bgzf_seek(hts_get_bgzfp(self.htsfile), offset, SEEK_SET)
 *         else:
 *             return hts_useek(self.htsfile, offset, SEEK_SET)             # <<<<<<<<<<<<<<
 * 
 *     def tell(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_int(hts_useek(__pyx_v_self->htsfile, __pyx_v_offset, SEEK_SET)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":2325
 *         return self.seek(self.start_offset, 0)
 * 
 *     def seek(self, uint64_t offset):             # <<<<<<<<<<<<<<
 *         """move file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`."""
 *         if not self.is_open:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2337
 *             return hts_useek(self.htsfile, offset, SEEK_SET)
 * 
 *     def tell(self):             # <<<<<<<<<<<<<<
 *         """return current file position, see :meth:`pysam.VariantFile.seek`."""
 *         if not self.is_open:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_25tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_24tell[] = "VariantFile.tell(self)\nreturn current file position, see :meth:`pysam.VariantFile.seek`.";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_25tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tell (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_24tell(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_24tell(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("tell", 0);
  __Pyx_TraceCall("tell", __pyx_f[0], 2337);

  /* "pysam/cbcf.pyx":2339
 *     def tell(self):
 *         """return current file position, see :meth:`pysam.VariantFile.seek`."""
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2340
 *         """return current file position, see :meth:`pysam.VariantFile.seek`."""
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 *         if self.is_stream:
 *             raise OSError('tell not available in streams')
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2341
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:             # <<<<<<<<<<<<<<
 *             raise OSError('tell not available in streams')
 * 
 */
  __pyx_t_3 = (__pyx_v_self->is_stream != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2342
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 *             raise OSError('tell not available in streams')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.format.compression != no_compression:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2344
 *             raise OSError('tell not available in streams')
 * 
 *         if self.htsfile.format.compression != no_compression:             # <<<<<<<<<<<<<<
 *             return bgzf_tell(hts_get_bgzfp(self.htsfile))
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_self->htsfile->format.compression != no_compression) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2345
 * 
 *         if self.htsfile.format.compression != no_compression:
 *             return bgzf_tell(hts_get_bgzfp(self.htsfile))             # <<<<<<<<<<<<<<
 *         else:
 *             return hts_utell(self.htsfile)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_int64_t(bgzf_tell(hts_get_bgzfp(__pyx_v_self->htsfile))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pysam/cbcf.pyx":2347
 *             return bgzf_tell(hts_get_bgzfp(self.htsfile))
 *         else:
 *             return hts_utell(self.htsfile)             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_long(hts_utell(__pyx_v_self->htsfile)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":2337
 *             return hts_useek(self.htsfile, offset, SEEK_SET)
 * 
 *     def tell(self):             # <<<<<<<<<<<<<<
 *         """return current file position, see :meth:`pysam.VariantFile.seek`."""
 *         if not self.is_open:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2349
 *             return hts_utell(self.htsfile)
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region` using 0-based indexing. The
 *         region is specified by :term:`contig`, *start* and *end*.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_27fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5pysam_4cbcf_11VariantFile_26fetch[] = "VariantFile.fetch(self, contig=None, start=None, stop=None, region=None, reopen=False)\nfetch records in a :term:`region` using 0-based indexing. The\n        region is specified by :term:`contig`, *start* and *end*.\n        Alternatively, a samtools :term:`region` string can be supplied.\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 :term:`VCF` file without a tabix index (.tbi) or a\n        :term:`BCF` file without a CSI index can only be read sequentially.\n        ";
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_27fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reopen,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contig);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_region);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reopen);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_26fetch(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen);

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_26fetch(struct __pyx_obj_5pysam_4cbcf_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_bcf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceCall("fetch", __pyx_f[0], 2349);

  /* "pysam/cbcf.pyx":2369
 *         :term:`BCF` file without a CSI index can only be 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_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2370
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2372
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.mode[0] != b'r':             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot fetch from Variantfile opened for writing')
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_r, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2373
 * 
 *         if self.mode[0] != b'r':
 *             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__89, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2375
 *             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);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_region == Py_None);
  __pyx_t_2 = (__pyx_t_4 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2376
 * 
 *         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/cbcf.pyx":2377
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 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/cbcf.pyx":2378
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)             # <<<<<<<<<<<<<<
 *             return iter(bcf)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_bcf, __pyx_n_s_seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_self->start_offset); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/cbcf.pyx":2379
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)
 *             return iter(bcf)             # <<<<<<<<<<<<<<
 * 
 *         if not self.index:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetIter(__pyx_v_bcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":2381
 *             return iter(bcf)
 * 
 *         if not self.index:             # <<<<<<<<<<<<<<
 *             raise ValueError('fetch requires an index')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->index)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2382
 * 
 *         if not self.index:
 *             raise ValueError('fetch requires an index')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__90, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2384
 *             raise ValueError('fetch requires an index')
 * 
 *         self.is_reading = 1             # <<<<<<<<<<<<<<
 *         return self.index.fetch(self, contig, start, stop, region, reopen)
 * 
 */
  __pyx_v_self->is_reading = 1;

  /* "pysam/cbcf.pyx":2385
 * 
 *         self.is_reading = 1
 *         return self.index.fetch(self, contig, start, stop, region, reopen)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int write(self, VariantRecord record) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->index), __pyx_n_s_fetch); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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;
    }
  }
  __pyx_t_6 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_8) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_contig);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_contig);
  __Pyx_GIVEREF(__pyx_v_contig);
  __Pyx_INCREF(__pyx_v_start);
  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_9, __pyx_v_start);
  __Pyx_GIVEREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);
  PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_9, __pyx_v_stop);
  __Pyx_GIVEREF(__pyx_v_stop);
  __Pyx_INCREF(__pyx_v_region);
  PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_9, __pyx_v_region);
  __Pyx_GIVEREF(__pyx_v_region);
  __Pyx_INCREF(__pyx_v_reopen);
  PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_9, __pyx_v_reopen);
  __Pyx_GIVEREF(__pyx_v_reopen);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2349
 *             return hts_utell(self.htsfile)
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region` using 0-based indexing. The
 *         region is specified by :term:`contig`, *start* and *end*.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bcf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2387
 *         return self.index.fetch(self, contig, start, stop, region, reopen)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
 */

static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_29write(PyObject *__pyx_v_self, PyObject *__pyx_v_record); /*proto*/
static int __pyx_f_5pysam_4cbcf_11VariantFile_write(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record, int __pyx_skip_dispatch) {
  int __pyx_v_ret;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_TraceCall("write", __pyx_f[0], 2387);
  /* 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_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_29write)) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_record)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_record));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_record));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_record));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __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;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pysam/cbcf.pyx":2393
 *         returns the number of bytes written.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {

    /* "pysam/cbcf.pyx":2394
 *         """
 *         if not self.is_open:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "pysam/cbcf.pyx":2396
 *             return 0
 * 
 *         cdef int ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
 */
  __pyx_v_ret = bcf_write1(__pyx_v_self->htsfile, __pyx_v_self->header->ptr, __pyx_v_record->ptr);

  /* "pysam/cbcf.pyx":2398
 *         cdef int ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('write failed')
 * 
 */
  __pyx_t_8 = ((__pyx_v_ret < 0) != 0);
  if (__pyx_t_8) {

    /* "pysam/cbcf.pyx":2399
 * 
 *         if ret < 0:
 *             raise ValueError('write failed')             # <<<<<<<<<<<<<<
 * 
 *         return ret
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2401
 *             raise ValueError('write failed')
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def subset_samples(self, include_samples):
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "pysam/cbcf.pyx":2387
 *         return self.index.fetch(self, contig, start, stop, region, reopen)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysam.cbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_29write(PyObject *__pyx_v_self, PyObject *__pyx_v_record); /*proto*/
static char __pyx_doc_5pysam_4cbcf_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 PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_29write(PyObject *__pyx_v_self, PyObject *__pyx_v_record) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record), __pyx_ptype_5pysam_4cbcf_VariantRecord, 1, "record", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_28write(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)__pyx_v_record));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_28write(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_4cbcf_VariantRecord *__pyx_v_record) {
  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_TraceDeclarations
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_TraceCall("write", __pyx_f[0], 2387);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_4cbcf_11VariantFile_write(__pyx_v_self, __pyx_v_record, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pyx":2403
 *         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_4cbcf_11VariantFile_31subset_samples(PyObject *__pyx_v_self, PyObject *__pyx_v_include_samples); /*proto*/
static char __pyx_doc_5pysam_4cbcf_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 PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_31subset_samples(PyObject *__pyx_v_self, PyObject *__pyx_v_include_samples) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subset_samples (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_30subset_samples(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self), ((PyObject *)__pyx_v_include_samples));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_30subset_samples(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_include_samples) {
  PyObject *__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_TraceDeclarations
  __Pyx_RefNannySetupContext("subset_samples", 0);
  __Pyx_TraceCall("subset_samples", __pyx_f[0], 2403);

  /* "pysam/cbcf.pyx":2408
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2409
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2411
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.mode[0] != b'r':             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_r, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2412
 * 
 *         if self.mode[0] != b'r':
 *             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__93, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2414
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
 *         if self.is_reading:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples after fetching records')
 * 
 */
  __pyx_t_3 = (__pyx_v_self->is_reading != 0);
  if (__pyx_t_3) {

    /* "pysam/cbcf.pyx":2415
 * 
 *         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__94, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pysam/cbcf.pyx":2417
 *             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_4cbcf_VariantHeader *)__pyx_v_self->header->__pyx_vtab)->_subset_samples(__pyx_v_self->header, __pyx_v_include_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":2420
 * 
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 2420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "pysam/cbcf.pyx":2421
 *         # potentially unnecessary optimization that also sets max_unpack
 *         if not include_samples:
 *             self.drop_samples = True             # <<<<<<<<<<<<<<
 */
    __pyx_v_self->drop_samples = 1;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysam/cbcf.pyx":2403
 *         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.cbcf.VariantFile.subset_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":144
 *     cdef int64_t  start_offset             # BGZF offset of first record
 * 
 *     cdef readonly object     filename      # filename as supplied by user             # <<<<<<<<<<<<<<
 *     cdef readonly object     mode          # file opening mode
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_8filename_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_8filename___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_8filename___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 144);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->filename);
  __pyx_r = __pyx_v_self->filename;
  goto __pyx_L0;

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

/* "pysam/cbcf.pxd":145
 * 
 *     cdef readonly object     filename      # filename as supplied by user
 *     cdef readonly object     mode          # file opening mode             # <<<<<<<<<<<<<<
 * 
 *     cdef readonly VariantHeader  header
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_4mode_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_4mode___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_4mode___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 145);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->mode);
  __pyx_r = __pyx_v_self->mode;
  goto __pyx_L0;

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

/* "pysam/cbcf.pxd":147
 *     cdef readonly object     mode          # file opening mode
 * 
 *     cdef readonly VariantHeader  header             # <<<<<<<<<<<<<<
 *     cdef readonly BaseIndex  index
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6header_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_6header___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6header___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 147);
  __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_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":148
 * 
 *     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_4cbcf_11VariantFile_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_5index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_5index___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_5index___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 148);
  __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_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":150
 *     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_4cbcf_11VariantFile_12drop_samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_12drop_samples_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_12drop_samples___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_12drop_samples___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 150);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->drop_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.drop_samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":153
 * 
 *     # FIXME: Temporary, use htsFormat when it is available
 *     cdef readonly bint       is_bcf        # true if file is a bcf file             # <<<<<<<<<<<<<<
 *     cdef readonly bint       is_stream     # true if not a seekable file but a stream
 *     cdef readonly bint       is_remote     # true if file is not on the local filesystem
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6is_bcf_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_6is_bcf_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_6is_bcf___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_6is_bcf___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 153);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_bcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.is_bcf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":154
 *     # FIXME: Temporary, use htsFormat when it is available
 *     cdef readonly bint       is_bcf        # true if file is a bcf file
 *     cdef readonly bint       is_stream     # true if not a seekable file but a stream             # <<<<<<<<<<<<<<
 *     cdef readonly bint       is_remote     # true if file is not on the local filesystem
 *     cdef readonly bint       is_reading    # true if file has begun reading records
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9is_stream_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9is_stream_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_9is_stream___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_9is_stream___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 154);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_stream); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.is_stream.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":155
 *     cdef readonly bint       is_bcf        # true if file is a bcf file
 *     cdef readonly bint       is_stream     # true if not a seekable file but a stream
 *     cdef readonly bint       is_remote     # true if file is not on the local filesystem             # <<<<<<<<<<<<<<
 *     cdef readonly bint       is_reading    # true if file has begun reading records
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9is_remote_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_9is_remote_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_9is_remote___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_9is_remote___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 155);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_remote); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.is_remote.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/cbcf.pxd":156
 *     cdef readonly bint       is_stream     # true if not a seekable file but a stream
 *     cdef readonly bint       is_remote     # true if file is not on the local filesystem
 *     cdef readonly bint       is_reading    # true if file has begun reading records             # <<<<<<<<<<<<<<
 * 
 *     cpdef int write(self, VariantRecord record) except -1
 */

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_10is_reading_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_4cbcf_11VariantFile_10is_reading_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5pysam_4cbcf_11VariantFile_10is_reading___get__(((struct __pyx_obj_5pysam_4cbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_4cbcf_11VariantFile_10is_reading___get__(struct __pyx_obj_5pysam_4cbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[1], 156);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_reading); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __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.cbcf.VariantFile.is_reading.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_5pysam_4cbcf_VariantHeader __pyx_vtable_5pysam_4cbcf_VariantHeader;

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeader(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeader *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)o);
  p->__pyx_vtab = __pyx_vtabptr_5pysam_4cbcf_VariantHeader;
  if (unlikely(__pyx_pw_5pysam_4cbcf_13VariantHeader_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeader(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_13VariantHeader_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7version_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7samples_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_records(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7records_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_contigs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7contigs_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_filters(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7filters_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_4info_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantHeader_formats(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantHeader_7formats_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeader[] = {
  {"copy", (PyCFunction)__pyx_pw_5pysam_4cbcf_13VariantHeader_9copy, METH_NOARGS, __pyx_doc_5pysam_4cbcf_13VariantHeader_8copy},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantHeader[] = {
  {(char *)"version", __pyx_getprop_5pysam_4cbcf_13VariantHeader_version, 0, __pyx_k_VCF_version, 0},
  {(char *)"samples", __pyx_getprop_5pysam_4cbcf_13VariantHeader_samples, 0, __pyx_k_samples_class_VariantHeaderSampl, 0},
  {(char *)"records", __pyx_getprop_5pysam_4cbcf_13VariantHeader_records, 0, __pyx_k_header_records_class_VariantHead, 0},
  {(char *)"contigs", __pyx_getprop_5pysam_4cbcf_13VariantHeader_contigs, 0, __pyx_k_contig_information_class_Variant, 0},
  {(char *)"filters", __pyx_getprop_5pysam_4cbcf_13VariantHeader_filters, 0, __pyx_k_filter_metadata_class_VariantHea, 0},
  {(char *)"info", __pyx_getprop_5pysam_4cbcf_13VariantHeader_info, 0, __pyx_k_info_metadata_class_VariantHeade, 0},
  {(char *)"formats", __pyx_getprop_5pysam_4cbcf_13VariantHeader_formats, 0, __pyx_k_format_metadata_class_VariantHea, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantHeader = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_13VariantHeader_7__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_VariantHeader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeader", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeader, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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_4cbcf_13VariantHeader_11__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "VariantHeader(mode)\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_4cbcf_VariantHeader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantHeader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_13VariantHeader_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderRecord(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantHeaderRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_4type_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_key(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_3key_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_value(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5value_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_attrs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantHeaderRecord_5attrs_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeaderRecord[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantHeaderRecord[] = {
  {(char *)"type", __pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_type, 0, __pyx_k_header_type_FILTER_INFO_FORMAT_C, 0},
  {(char *)"key", __pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_key, 0, __pyx_k_header_key_the_part_before_in_FI, 0},
  {(char *)"value", __pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_value, 0, __pyx_k_header_value_Set_only_for_generi, 0},
  {(char *)"attrs", __pyx_getprop_5pysam_4cbcf_19VariantHeaderRecord_attrs, 0, __pyx_k_sequence_of_additional_header_at, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantHeaderRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeaderRecord", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderRecord, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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_4cbcf_19VariantHeaderRecord_1__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*/
  "header record from a :class:`VariantHeader` object", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderRecord, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantHeaderRecord, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantHeaderRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantHeaderRecord, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderRecords(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderRecords(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderRecords(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantHeaderRecords(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeaderRecords[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantHeaderRecords = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderRecords_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderRecords_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_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_4cbcf_20VariantHeaderRecords_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantHeaderRecords = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeaderRecords", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderRecords, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderRecords, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantHeaderRecords, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderRecords_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantHeaderRecords, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderContigs(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderContigs(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderContigs(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantHeaderContigs(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeaderContigs[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantHeaderContigs_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantHeaderContigs = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderContigs_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderContigs_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantHeaderContigs, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderContigs = {
  __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantHeaderContigs = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeaderContigs", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderContigs, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from contig name or index to :class:`VariantContig` object.", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderContigs, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantHeaderContigs, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderContigs_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantHeaderContigs, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderSamples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderSamples(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderSamples(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantHeaderSamples(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeaderSamples[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantHeaderSamples = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderSamples_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantHeaderSamples_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantHeaderSamples, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_10__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderSamples = {
  __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantHeaderSamples = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeaderSamples", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderSamples, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "sequence of sample names from a :class:`VariantHeader` object", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderSamples, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantHeaderSamples, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_20VariantHeaderSamples_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantHeaderSamples, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantContig(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantContig *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantContig *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantContig(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantContig *p = (struct __pyx_obj_5pysam_4cbcf_VariantContig *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantContig(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantContig *p = (struct __pyx_obj_5pysam_4cbcf_VariantContig *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantContig(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantContig *p = (struct __pyx_obj_5pysam_4cbcf_VariantContig *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantContig_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantContig_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantContig_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantContig_2id_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantContig_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantContig_6length_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantContig_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantContig_6header_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantContig[] = {
  {(char *)"name", __pyx_getprop_5pysam_4cbcf_13VariantContig_name, 0, __pyx_k_contig_name, 0},
  {(char *)"id", __pyx_getprop_5pysam_4cbcf_13VariantContig_id, 0, __pyx_k_contig_internal_id_number, 0},
  {(char *)"length", __pyx_getprop_5pysam_4cbcf_13VariantContig_length, 0, __pyx_k_contig_length_or_None_if_not_ava, 0},
  {(char *)"header", __pyx_getprop_5pysam_4cbcf_13VariantContig_header, 0, __pyx_k_class_VariantHeaderRecord_assoc, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantContig = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantContig", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantContig), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantContig, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "contig metadata from a :class:`VariantHeader`", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantContig, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantContig, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantContig, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantMetadata(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantMetadata(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantMetadata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantMetadata(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantMetadata *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_4cbcf_15VariantMetadata_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_15VariantMetadata_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_15VariantMetadata_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_15VariantMetadata_2id_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_15VariantMetadata_number(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_15VariantMetadata_6number_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_15VariantMetadata_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_15VariantMetadata_4type_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_15VariantMetadata_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_15VariantMetadata_6header_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantMetadata[] = {
  {(char *)"name", __pyx_getprop_5pysam_4cbcf_15VariantMetadata_name, 0, __pyx_k_metadata_name, 0},
  {(char *)"id", __pyx_getprop_5pysam_4cbcf_15VariantMetadata_id, 0, __pyx_k_metadata_internal_header_id_numb, 0},
  {(char *)"number", __pyx_getprop_5pysam_4cbcf_15VariantMetadata_number, 0, __pyx_k_metadata_number_i_e_cardinality, 0},
  {(char *)"type", __pyx_getprop_5pysam_4cbcf_15VariantMetadata_type, 0, __pyx_k_metadata_value_type, 0},
  {(char *)"header", __pyx_getprop_5pysam_4cbcf_15VariantMetadata_header, 0, __pyx_k_class_VariantHeaderRecord_assoc_2, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantMetadata = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantMetadata", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantMetadata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantMetadata, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "filter, info or format metadata record from a :class:`VariantHeader` object", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantMetadata, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantMetadata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantMetadata, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantHeaderMetadata(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderMetadata(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderMetadata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantHeaderMetadata(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantHeaderMetadata[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_21VariantHeaderMetadata_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantHeaderMetadata = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_21VariantHeaderMetadata_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_21VariantHeaderMetadata_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantHeaderMetadata, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderMetadata = {
  __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantHeaderMetadata = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantHeaderMetadata", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantHeaderMetadata, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from filter, info or format name to :class:`VariantMetadata` object", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantHeaderMetadata, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantHeaderMetadata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_21VariantHeaderMetadata_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantHeaderMetadata, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecord(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecord *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_13VariantRecord_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->header);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecord *)o;
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecord *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecord *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_rid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_3rid_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_chrom(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_5chrom_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_contig(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_6contig_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_pos(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_3pos_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_start(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_5start_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_stop(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_4stop_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_rlen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_4rlen_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_qual(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_4qual_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_2id_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_ref(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_3ref_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_alleles(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_7alleles_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_alts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_4alts_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_filter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_6filter_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_4info_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_format(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_6format_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_13VariantRecord_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_13VariantRecord_7samples_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_VariantRecord[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantRecord[] = {
  {(char *)"rid", __pyx_getprop_5pysam_4cbcf_13VariantRecord_rid, 0, __pyx_k_internal_reference_id_number, 0},
  {(char *)"chrom", __pyx_getprop_5pysam_4cbcf_13VariantRecord_chrom, 0, __pyx_k_chromosome_contig_name, 0},
  {(char *)"contig", __pyx_getprop_5pysam_4cbcf_13VariantRecord_contig, 0, __pyx_k_chromosome_contig_name, 0},
  {(char *)"pos", __pyx_getprop_5pysam_4cbcf_13VariantRecord_pos, 0, __pyx_k_record_start_position_on_chrom_c, 0},
  {(char *)"start", __pyx_getprop_5pysam_4cbcf_13VariantRecord_start, 0, __pyx_k_record_start_position_on_chrom_c_2, 0},
  {(char *)"stop", __pyx_getprop_5pysam_4cbcf_13VariantRecord_stop, 0, __pyx_k_record_stop_position_on_chrom_co, 0},
  {(char *)"rlen", __pyx_getprop_5pysam_4cbcf_13VariantRecord_rlen, 0, __pyx_k_record_length_on_chrom_contig_re, 0},
  {(char *)"qual", __pyx_getprop_5pysam_4cbcf_13VariantRecord_qual, 0, __pyx_k_phred_scaled_quality_score_or_No, 0},
  {(char *)"id", __pyx_getprop_5pysam_4cbcf_13VariantRecord_id, 0, __pyx_k_record_identifier_or_None_if_not, 0},
  {(char *)"ref", __pyx_getprop_5pysam_4cbcf_13VariantRecord_ref, 0, __pyx_k_reference_allele, 0},
  {(char *)"alleles", __pyx_getprop_5pysam_4cbcf_13VariantRecord_alleles, 0, __pyx_k_tuple_of_reference_allele_follow, 0},
  {(char *)"alts", __pyx_getprop_5pysam_4cbcf_13VariantRecord_alts, 0, __pyx_k_tuple_of_alt_alleles, 0},
  {(char *)"filter", __pyx_getprop_5pysam_4cbcf_13VariantRecord_filter, 0, __pyx_k_filter_information_see_class_Var, 0},
  {(char *)"info", __pyx_getprop_5pysam_4cbcf_13VariantRecord_info, 0, __pyx_k_info_data_see_class_VariantRecor, 0},
  {(char *)"format", __pyx_getprop_5pysam_4cbcf_13VariantRecord_format, 0, __pyx_k_sample_format_metadata_see_class, 0},
  {(char *)"samples", __pyx_getprop_5pysam_4cbcf_13VariantRecord_samples, 0, __pyx_k_sample_data_see_class_VariantRec, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecord", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecord, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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_4cbcf_13VariantRecord_3__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*/
  "Variant record", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecord, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecord, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantRecord, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordFilter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)o);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordFilter(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecordFilter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)o;
  if (p->record) {
    e = (*v)(((PyObject*)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecordFilter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantRecordFilter[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFilter_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFilter_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantRecordFilter = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordFilter_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordFilter_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantRecordFilter, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordFilter = {
  __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecordFilter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecordFilter", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordFilter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from filter index or name to :class:`VariantMetadata` object for filters set on a :class:`VariantRecord` object.", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecordFilter, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecordFilter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFilter_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecordFilter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordFormat(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)o);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordFormat(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecordFormat(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)o;
  if (p->record) {
    e = (*v)(((PyObject*)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecordFormat(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantRecordFormat[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordFormat_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordFormat_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantRecordFormat = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordFormat_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordFormat_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantRecordFormat, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordFormat = {
  __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecordFormat = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecordFormat", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordFormat, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from format name or index to :class:`VariantMetadata` object for formats present in a :class:`VariantRecord` object.", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecordFormat, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecordFormat, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordFormat_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecordFormat, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)o);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordInfo(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecordInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)o;
  if (p->record) {
    e = (*v)(((PyObject*)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecordInfo(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyMethodDef __pyx_methods_5pysam_4cbcf_VariantRecordInfo[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_17VariantRecordInfo_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_17VariantRecordInfo_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantRecordInfo = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_17VariantRecordInfo_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_17VariantRecordInfo_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantRecordInfo, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordInfo = {
  __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecordInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecordInfo", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordInfo, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from info metadata name to value for info data present in a :class:`VariantRecord` object.", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecordInfo, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecordInfo, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_17VariantRecordInfo_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecordInfo, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordSamples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)o);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordSamples(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecordSamples(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)o;
  if (p->record) {
    e = (*v)(((PyObject*)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecordSamples(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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_4cbcf_VariantRecordSamples[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_20VariantRecordSamples_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_20VariantRecordSamples_25values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantRecordSamples = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantRecordSamples_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_20VariantRecordSamples_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantRecordSamples, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordSamples = {
  __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecordSamples = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecordSamples", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordSamples, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "mapping from sample index or name to :class:`makeVariantRecordSample` object.", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecordSamples, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecordSamples, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_20VariantRecordSamples_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecordSamples, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantRecordSample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)o);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordSample(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantRecordSample(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)o;
  if (p->record) {
    e = (*v)(((PyObject*)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantRecordSample(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5pysam_4cbcf_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 PyObject *__pyx_getprop_5pysam_4cbcf_19VariantRecordSample_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantRecordSample_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantRecordSample_allele_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantRecordSample_14allele_indices_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantRecordSample_alleles(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantRecordSample_7alleles_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_19VariantRecordSample_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_19VariantRecordSample_5index_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_VariantRecordSample[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_10get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_9get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_14iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_13iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_16itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_15itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_19iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_18iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_22keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_21keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_24items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_23items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_19VariantRecordSample_26values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_19VariantRecordSample_25values},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantRecordSample[] = {
  {(char *)"name", __pyx_getprop_5pysam_4cbcf_19VariantRecordSample_name, 0, __pyx_k_sample_name, 0},
  {(char *)"allele_indices", __pyx_getprop_5pysam_4cbcf_19VariantRecordSample_allele_indices, 0, __pyx_k_allele_indices_for_called_genoty, 0},
  {(char *)"alleles", __pyx_getprop_5pysam_4cbcf_19VariantRecordSample_alleles, 0, __pyx_k_alleles_for_called_genotype_if_p, 0},
  {(char *)"index", __pyx_getprop_5pysam_4cbcf_19VariantRecordSample_index, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_VariantRecordSample = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordSample_3__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_19VariantRecordSample_1__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_VariantRecordSample, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordSample_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordSample = {
  __pyx_pw_5pysam_4cbcf_19VariantRecordSample_1__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordSample_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantRecordSample = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantRecordSample", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantRecordSample), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantRecordSample, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "Data for a single sample from a :class:`VariantRecord` object.\n       Provides data accessors for genotypes and a mapping interface from format name to values.\n    ", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantRecordSample, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantRecordSample, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_19VariantRecordSample_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantRecordSample, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantRecordSample, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_BaseIndex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_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_4cbcf_BaseIndex(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *p = (struct __pyx_obj_5pysam_4cbcf_BaseIndex *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->refs);
  Py_CLEAR(p->refmap);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_BaseIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *p = (struct __pyx_obj_5pysam_4cbcf_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_4cbcf_BaseIndex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_BaseIndex *p = (struct __pyx_obj_5pysam_4cbcf_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_4cbcf_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_4cbcf_BaseIndex[] = {
  {"get", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_11get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_9BaseIndex_10get},
  {"iterkeys", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_15iterkeys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_14iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_17itervalues, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_16itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_20iteritems, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_19iteritems},
  {"keys", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_23keys, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_22keys},
  {"items", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_25items, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_24items},
  {"values", (PyCFunction)__pyx_pw_5pysam_4cbcf_9BaseIndex_27values, METH_NOARGS, __pyx_doc_5pysam_4cbcf_9BaseIndex_26values},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BaseIndex = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_9BaseIndex_5__bool__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  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
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  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_4cbcf_9BaseIndex_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_4cbcf_BaseIndex, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_4cbcf_9BaseIndex_13__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BaseIndex = {
  __pyx_pw_5pysam_4cbcf_9BaseIndex_3__len__, /*mp_length*/
  __pyx_pw_5pysam_4cbcf_9BaseIndex_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_4cbcf_BaseIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.BaseIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_BaseIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "BaseIndex()", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_BaseIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_BaseIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_9BaseIndex_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_BaseIndex, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_9BaseIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_BCFIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *p;
  PyObject *o = __pyx_tp_new_5pysam_4cbcf_BaseIndex(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)o);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_BCFIndex(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *p = (struct __pyx_obj_5pysam_4cbcf_BCFIndex *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_8BCFIndex_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->header);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIndex(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_BCFIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *p = (struct __pyx_obj_5pysam_4cbcf_BCFIndex *)o;
  e = __pyx_tp_traverse_5pysam_4cbcf_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_4cbcf_BCFIndex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_BCFIndex *p = (struct __pyx_obj_5pysam_4cbcf_BCFIndex *)o;
  __pyx_tp_clear_5pysam_4cbcf_BaseIndex(o);
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_BCFIndex[] = {
  {"fetch", (PyCFunction)__pyx_pw_5pysam_4cbcf_8BCFIndex_5fetch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_8BCFIndex_4fetch},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_BCFIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.BCFIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_BCFIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_BCFIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "BCFIndex()\nCSI index data structure for BCF files", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_BCFIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_BCFIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5pysam_4cbcf_9BaseIndex_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_BCFIndex, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_8BCFIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_TabixIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5pysam_4cbcf_BaseIndex(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_TabixIndex(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_10TabixIndex_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIndex(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_TabixIndex[] = {
  {"fetch", (PyCFunction)__pyx_pw_5pysam_4cbcf_10TabixIndex_5fetch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_10TabixIndex_4fetch},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_TabixIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.TabixIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_TabixIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_TabixIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "TabixIndex()\nTabix index data structure for VCF files", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_BaseIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_BaseIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5pysam_4cbcf_9BaseIndex_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_TabixIndex, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_10TabixIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_TabixIndex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_BaseIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_BaseIterator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_BaseIterator *)o);
  p->bcf = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_BaseIterator(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_BaseIterator *p = (struct __pyx_obj_5pysam_4cbcf_BaseIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->bcf);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_BaseIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_BaseIterator *p = (struct __pyx_obj_5pysam_4cbcf_BaseIterator *)o;
  if (p->bcf) {
    e = (*v)(((PyObject*)p->bcf), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_BaseIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_BaseIterator *p = (struct __pyx_obj_5pysam_4cbcf_BaseIterator *)o;
  tmp = ((PyObject*)p->bcf);
  p->bcf = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf_BaseIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.BaseIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_BaseIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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_4cbcf_BaseIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_BaseIterator, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_BCFIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_BCFIterator *p;
  PyObject *o = __pyx_tp_new_5pysam_4cbcf_BaseIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_BCFIterator *)o);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_BCFIterator(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_BCFIterator *p = (struct __pyx_obj_5pysam_4cbcf_BCFIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_11BCFIterator_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->index);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIterator(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_BCFIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_BCFIterator *p = (struct __pyx_obj_5pysam_4cbcf_BCFIterator *)o;
  e = __pyx_tp_traverse_5pysam_4cbcf_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_4cbcf_BCFIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_BCFIterator *p = (struct __pyx_obj_5pysam_4cbcf_BCFIterator *)o;
  __pyx_tp_clear_5pysam_4cbcf_BaseIterator(o);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_BCFIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_BCFIterator[] = {
  {"__next__", (PyCFunction)__pyx_pw_5pysam_4cbcf_11BCFIterator_7__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_BCFIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.BCFIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_BCFIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_BCFIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "BCFIterator(VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True)", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_BCFIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_BCFIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_11BCFIterator_5__iter__, /*tp_iter*/
  __pyx_pw_5pysam_4cbcf_11BCFIterator_7__next__, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_BCFIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_11BCFIterator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5pysam_4cbcf_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_TabixIterator *p;
  PyObject *o = __pyx_tp_new_5pysam_4cbcf_BaseIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_TabixIterator *)o);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5pysam_4cbcf_13TabixIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_TabixIterator(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_TabixIterator *p = (struct __pyx_obj_5pysam_4cbcf_TabixIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_13TabixIterator_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->index);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_4cbcf_BaseIterator(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_TabixIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_TabixIterator *p = (struct __pyx_obj_5pysam_4cbcf_TabixIterator *)o;
  e = __pyx_tp_traverse_5pysam_4cbcf_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_4cbcf_TabixIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_TabixIterator *p = (struct __pyx_obj_5pysam_4cbcf_TabixIterator *)o;
  __pyx_tp_clear_5pysam_4cbcf_BaseIterator(o);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_TabixIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_TabixIterator[] = {
  {"__next__", (PyCFunction)__pyx_pw_5pysam_4cbcf_13TabixIterator_9__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_TabixIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.TabixIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_TabixIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_TabixIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "TabixIterator(VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True)", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_TabixIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_TabixIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_13TabixIterator_7__iter__, /*tp_iter*/
  __pyx_pw_5pysam_4cbcf_13TabixIterator_9__next__, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_TabixIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_13TabixIterator_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5pysam_4cbcf_VariantFile __pyx_vtable_5pysam_4cbcf_VariantFile;

static PyObject *__pyx_tp_new_5pysam_4cbcf_VariantFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_4cbcf_VariantFile *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_4cbcf_VariantFile *)o);
  p->__pyx_vtab = __pyx_vtabptr_5pysam_4cbcf_VariantFile;
  p->filename = Py_None; Py_INCREF(Py_None);
  p->mode = Py_None; Py_INCREF(Py_None);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5pysam_4cbcf_11VariantFile_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf_VariantFile(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf_VariantFile *p = (struct __pyx_obj_5pysam_4cbcf_VariantFile *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5pysam_4cbcf_11VariantFile_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->filename);
  Py_CLEAR(p->mode);
  Py_CLEAR(p->header);
  Py_CLEAR(p->index);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5pysam_4cbcf_VariantFile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf_VariantFile *p = (struct __pyx_obj_5pysam_4cbcf_VariantFile *)o;
  if (p->filename) {
    e = (*v)(p->filename, a); if (e) return e;
  }
  if (p->mode) {
    e = (*v)(p->mode, a); if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject*)p->header), a); if (e) return e;
  }
  if (p->index) {
    e = (*v)(((PyObject*)p->index), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf_VariantFile(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf_VariantFile *p = (struct __pyx_obj_5pysam_4cbcf_VariantFile *)o;
  tmp = ((PyObject*)p->filename);
  p->filename = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mode);
  p->mode = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_4cbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_category(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_8category_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_format(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_6format_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_7version_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_compression(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_11compression_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_11description_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_is_open(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_7is_open_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_filename(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_8filename_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_mode(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_4mode_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_6header_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_5index_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_drop_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_12drop_samples_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_is_bcf(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_6is_bcf_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_is_stream(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_9is_stream_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_is_remote(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_9is_remote_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_4cbcf_11VariantFile_is_reading(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_4cbcf_11VariantFile_10is_reading_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_4cbcf_VariantFile[] = {
  {"__enter__", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_7__enter__, METH_NOARGS, __pyx_doc_5pysam_4cbcf_11VariantFile_6__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_9__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_11VariantFile_8__exit__},
  {"close", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_11close, METH_NOARGS, __pyx_doc_5pysam_4cbcf_11VariantFile_10close},
  {"__next__", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_15__next__, METH_NOARGS|METH_COEXIST, 0},
  {"copy", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_17copy, METH_NOARGS, __pyx_doc_5pysam_4cbcf_11VariantFile_16copy},
  {"open", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_19open, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_11VariantFile_18open},
  {"reset", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_21reset, METH_NOARGS, __pyx_doc_5pysam_4cbcf_11VariantFile_20reset},
  {"seek", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_23seek, METH_O, __pyx_doc_5pysam_4cbcf_11VariantFile_22seek},
  {"tell", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_25tell, METH_NOARGS, __pyx_doc_5pysam_4cbcf_11VariantFile_24tell},
  {"fetch", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_27fetch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_4cbcf_11VariantFile_26fetch},
  {"write", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_29write, METH_O, __pyx_doc_5pysam_4cbcf_11VariantFile_28write},
  {"subset_samples", (PyCFunction)__pyx_pw_5pysam_4cbcf_11VariantFile_31subset_samples, METH_O, __pyx_doc_5pysam_4cbcf_11VariantFile_30subset_samples},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_4cbcf_VariantFile[] = {
  {(char *)"category", __pyx_getprop_5pysam_4cbcf_11VariantFile_category, 0, __pyx_k_General_file_format_category_One, 0},
  {(char *)"format", __pyx_getprop_5pysam_4cbcf_11VariantFile_format, 0, __pyx_k_File_format_One_of_UNKNOWN_BINAR, 0},
  {(char *)"version", __pyx_getprop_5pysam_4cbcf_11VariantFile_version, 0, __pyx_k_Tuple_of_file_format_version_num, 0},
  {(char *)"compression", __pyx_getprop_5pysam_4cbcf_11VariantFile_compression, 0, __pyx_k_File_compression_One_of_NONE_GZI, 0},
  {(char *)"description", __pyx_getprop_5pysam_4cbcf_11VariantFile_description, 0, __pyx_k_Vaguely_human_readable_descripti, 0},
  {(char *)"is_open", __pyx_getprop_5pysam_4cbcf_11VariantFile_is_open, 0, 0, 0},
  {(char *)"filename", __pyx_getprop_5pysam_4cbcf_11VariantFile_filename, 0, 0, 0},
  {(char *)"mode", __pyx_getprop_5pysam_4cbcf_11VariantFile_mode, 0, 0, 0},
  {(char *)"header", __pyx_getprop_5pysam_4cbcf_11VariantFile_header, 0, 0, 0},
  {(char *)"index", __pyx_getprop_5pysam_4cbcf_11VariantFile_index, 0, 0, 0},
  {(char *)"drop_samples", __pyx_getprop_5pysam_4cbcf_11VariantFile_drop_samples, 0, 0, 0},
  {(char *)"is_bcf", __pyx_getprop_5pysam_4cbcf_11VariantFile_is_bcf, 0, 0, 0},
  {(char *)"is_stream", __pyx_getprop_5pysam_4cbcf_11VariantFile_is_stream, 0, 0, 0},
  {(char *)"is_remote", __pyx_getprop_5pysam_4cbcf_11VariantFile_is_remote, 0, 0, 0},
  {(char *)"is_reading", __pyx_getprop_5pysam_4cbcf_11VariantFile_is_reading, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5pysam_4cbcf_VariantFile = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.VariantFile", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf_VariantFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf_VariantFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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*/
  "VariantFile(*args, **kwargs)\n*(filename, mode=None, header=None, drop_samples=False)*\n\n    A :term:`VCF`/:term:`BCF` formatted file. The file is automatically\n    opened.\n\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','rb')\n\n    If mode is not specified, we will try to auto-detect in the order 'rb',\n    'r', thus both the following should work::\n\n        f1 = pysam.VariantFile('ex1.bcf')\n        f2 = pysam.VariantFile('ex1.vcf')\n\n    If an index for a variant file exists (.csi or .tbi), it will be opened\n    automatically.  Without an index random access to records via\n    :meth:`fetch` is disabled.\n\n    For writing, a :class:`VariantHeader` object must be provided, typically\n    obtained from another :term:`VCF` file/:term:`BCF` file.\n    ", /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf_VariantFile, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf_VariantFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_4cbcf_11VariantFile_13__iter__, /*tp_iter*/
  __pyx_pw_5pysam_4cbcf_11VariantFile_15__next__, /*tp_iternext*/
  __pyx_methods_5pysam_4cbcf_VariantFile, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_4cbcf_VariantFile, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5pysam_4cbcf_11VariantFile_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple(PyObject *o) {
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_1_genexpr[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_1_genexpr[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_1_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_1_genexpr, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_2___get__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_2___get__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_2___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_2___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_2___get__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_2___get__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_2___get__(PyObject *o) {
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_2___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_2___get__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_2___get__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_2___get__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_2___get__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_2___get__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_2___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_3_genexpr[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_3_genexpr[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_3_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_2___get__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_3_genexpr, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_4___str__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_4___str__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_4___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_4___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_4___str__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_4___str__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_4___str__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_4___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_4___str__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_4___str__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_4___str__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)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_4cbcf___pyx_scope_struct_4___str__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_4___str__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_4___str__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_4___str__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_4___str__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_4___str__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_4___str__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_5_genexpr[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_5_genexpr = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_5_genexpr[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_k);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_5_genexpr[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_k) {
    e = (*v)(p->__pyx_v_k, 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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_5_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_4___str__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_k);
  p->__pyx_v_k = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_v);
  p->__pyx_v_v = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_5_genexpr, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_5_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_6___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_6___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_6___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_6___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_6___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_6___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_6___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_6___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_6___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_6___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_6___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)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_4cbcf___pyx_scope_struct_6___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderRecords *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_6___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_6___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_6___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_6___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_6___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_6___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_6___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_7___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_7___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_7___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_7___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_7___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_7___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_7___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_7___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_7___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_7___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_7___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_7___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_7___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_8_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_8_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_8_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_8_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_8_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_8_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_8_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_8_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_8_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_8_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_8_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_8_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_8_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_8_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_8_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_8_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_8_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_8_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_9_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_9_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_9_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_9_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_9_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_9_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_9_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_9_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_9_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_9_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_9_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_9_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderMetadata *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_9_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_9_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_9_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_9_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_9_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_9_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_10___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_10___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_10___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_10___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_10___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_10___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_10___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_10___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_10___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_10___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_10___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_10___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_10___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_10___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_10___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_10___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_10___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_10___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_11_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_11_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_11_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_11_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_11_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_11_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_11_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_11_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_11_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_11_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_11_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_11_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_11_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_11_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_11_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_11_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_11_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_11_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_11_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_12_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_12_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_12_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_12_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_12_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_12_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_12_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_12_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_12_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_12_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_12_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_12_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderContigs *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_12_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_12_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_12_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_12_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_12_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_12_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_12_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_13___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_13___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_13___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_13___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_13___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_13___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_13___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_13___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_13___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_13___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_13___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)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_4cbcf___pyx_scope_struct_13___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantHeaderSamples *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_13___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_13___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_13___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_13___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_13___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_13___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_13___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_14___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_14___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_14___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_14___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_14___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_14___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_14___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_14___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_14___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_14___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_14___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_14___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_14___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_14___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_14___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_14___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_14___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_14___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_15_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_15_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_15_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_15_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_15_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_15_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_15_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_15_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_15_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_15_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_15_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_15_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_15_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_15_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_15_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_15_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_15_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_15_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_16_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_16_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_16_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_16_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_16_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_16_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_16_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_16_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_16_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_16_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_16_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_16_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFilter *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_16_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_16_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_16_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_16_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_16_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_16_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_17___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_17___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_17___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_17___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_17___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_17___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_17___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_17___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_17___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_17___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_17___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_17___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_17___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_17___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_17___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_17___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_17___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_17___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_18_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_18_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_18_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_18_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_18_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_18_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_18_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_18_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_18_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_18_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_18_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_18_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_18_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_18_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_18_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_18_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_18_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_18_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_18_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_19_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_19_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_19_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_19_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_19_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_19_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_19_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_19_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_19_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_19_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_19_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_19_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordFormat *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_19_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_19_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_19_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_19_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_19_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_19_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_19_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_20___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_20___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_20___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_20___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_20___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_20___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_20___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_20___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_20___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_20___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_20___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)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_4cbcf___pyx_scope_struct_20___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_20___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_20___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_20___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_20___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_20___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_20___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_20___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_21_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_21_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_21_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_21_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_21_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_21_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_21_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_21_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_21_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_21_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_21_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)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_4cbcf___pyx_scope_struct_21_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_21_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_21_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_21_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_21_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_21_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_21_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_21_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_22_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_22_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_22_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_22_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_22_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_22_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_22_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_value);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_22_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_22_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_22_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_22_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_22_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordInfo *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_value);
  p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_22_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_22_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_22_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_22_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_22_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_22_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_22_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_23___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_23___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_23___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_23___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_23___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_23___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_23___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_23___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_23___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_23___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_23___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)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_4cbcf___pyx_scope_struct_23___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_23___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_23___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_23___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_23___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_23___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_23___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_23___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_24_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_24_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_24_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_24_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_24_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_24_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_24_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_24_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_24_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_24_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_24_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)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_4cbcf___pyx_scope_struct_24_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_24_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_24_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_24_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_24_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_24_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_24_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_24_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_25_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_25_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_25_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_25_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_25_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_25_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_25_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_25_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_25_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_25_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_25_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)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_4cbcf___pyx_scope_struct_25_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSamples *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_25_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_25_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_25_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_25_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_25_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_25_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_25_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_26___get__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_26___get__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_26___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_26___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_26___get__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_26___get__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_26___get__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_26___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_26___get__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_26___get__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_26___get__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)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_4cbcf___pyx_scope_struct_26___get__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_26___get__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_26___get__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_26___get__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_26___get__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_26___get__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_26___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_27_genexpr[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_27_genexpr = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_27_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_27_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_27_genexpr[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_27_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_27_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_27_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_27_genexpr[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_27_genexpr++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_27_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_27_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_26___get__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_27_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_27_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_27_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_27_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_27_genexpr, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_27_genexpr, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_27_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_28___get__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_28___get__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_28___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_28___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_28___get__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_28___get__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_28___get__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_28___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_28___get__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_28___get__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_28___get__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)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_4cbcf___pyx_scope_struct_28___get__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_28___get__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_28___get__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_28___get__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_28___get__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_28___get__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_28___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_29_genexpr[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_29_genexpr = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_29_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_29_genexpr[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_29_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_29_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_29_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_29_genexpr[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_29_genexpr++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_29_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_28___get__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_29_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_29_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_29_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_29_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_29_genexpr, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_29_genexpr, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_29_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_30___iter__[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_30___iter__ = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_30___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_30___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_30___iter__[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_30___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_30___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_30___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_30___iter__[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_30___iter__++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_30___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)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_4cbcf___pyx_scope_struct_30___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_30___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_30___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_30___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_30___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_30___iter__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_30___iter__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_30___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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_31_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_31_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_31_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_31_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_31_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_31_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_31_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_31_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_31_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_31_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_31_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_31_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_31_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_31_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_31_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_31_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_31_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_31_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_31_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_32_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_32_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_32_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_32_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_32_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_32_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_32_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_32_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_32_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_32_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_32_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_32_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_VariantRecordSample *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_32_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_32_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_32_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_32_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_32_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_32_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_32_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_33_itervalues[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_33_itervalues = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_33_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_33_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_33_itervalues[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_33_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_33_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_33_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_33_itervalues[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_33_itervalues++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_33_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_33_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_33_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_33_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_33_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_33_itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_33_itervalues, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_33_itervalues, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_33_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
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_34_iteritems[8];
static int __pyx_freecount_5pysam_4cbcf___pyx_scope_struct_34_iteritems = 0;

static PyObject *__pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_34_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_34_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems)))) {
    o = (PyObject*)__pyx_freelist_5pysam_4cbcf___pyx_scope_struct_34_iteritems[--__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_34_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_34_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_34_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems)))) {
    __pyx_freelist_5pysam_4cbcf___pyx_scope_struct_34_iteritems[__pyx_freecount_5pysam_4cbcf___pyx_scope_struct_34_iteritems++] = ((struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_34_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_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;
}

static int __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_34_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *p = (struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_key);
  p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_4cbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5pysam_4cbcf___pyx_scope_struct_34_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.cbcf.__pyx_scope_struct_34_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_4cbcf___pyx_scope_struct_34_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_4cbcf___pyx_scope_struct_34_iteritems, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #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, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_4cbcf___pyx_scope_struct_34_iteritems, /*tp_traverse*/
  __pyx_tp_clear_5pysam_4cbcf___pyx_scope_struct_34_iteritems, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_4cbcf___pyx_scope_struct_34_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
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "cbcf",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_ALIGNMENTS, __pyx_k_ALIGNMENTS, sizeof(__pyx_k_ALIGNMENTS), 0, 0, 1, 1},
  {&__pyx_kp_s_Argument_must_be_string_bytes_or, __pyx_k_Argument_must_be_string_bytes_or, sizeof(__pyx_k_Argument_must_be_string_bytes_or), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_must_be_string_or_unico, __pyx_k_Argument_must_be_string_or_unico, sizeof(__pyx_k_Argument_must_be_string_or_unico), 0, 0, 1, 0},
  {&__pyx_n_s_BAI, __pyx_k_BAI, sizeof(__pyx_k_BAI), 0, 0, 1, 1},
  {&__pyx_n_s_BAM, __pyx_k_BAM, sizeof(__pyx_k_BAM), 0, 0, 1, 1},
  {&__pyx_n_s_BCF, __pyx_k_BCF, sizeof(__pyx_k_BCF), 0, 0, 1, 1},
  {&__pyx_n_s_BED, __pyx_k_BED, sizeof(__pyx_k_BED), 0, 0, 1, 1},
  {&__pyx_n_s_BGZF, __pyx_k_BGZF, sizeof(__pyx_k_BGZF), 0, 0, 1, 1},
  {&__pyx_n_s_BINARY_FORMAT, __pyx_k_BINARY_FORMAT, sizeof(__pyx_k_BINARY_FORMAT), 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_itervalues, __pyx_k_BaseIndex_itervalues, sizeof(__pyx_k_BaseIndex_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_CONTIG, __pyx_k_CONTIG, sizeof(__pyx_k_CONTIG), 0, 0, 1, 1},
  {&__pyx_n_s_CRAI, __pyx_k_CRAI, sizeof(__pyx_k_CRAI), 0, 0, 1, 1},
  {&__pyx_n_s_CRAM, __pyx_k_CRAM, sizeof(__pyx_k_CRAM), 0, 0, 1, 1},
  {&__pyx_n_s_CSI, __pyx_k_CSI, sizeof(__pyx_k_CSI), 0, 0, 1, 1},
  {&__pyx_n_s_CUSTOM, __pyx_k_CUSTOM, sizeof(__pyx_k_CUSTOM), 0, 0, 1, 1},
  {&__pyx_kp_s_Cannot_re_open_htsfile, __pyx_k_Cannot_re_open_htsfile, sizeof(__pyx_k_Cannot_re_open_htsfile), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_retrieve_reference_sequen, __pyx_k_Cannot_retrieve_reference_sequen, sizeof(__pyx_k_Cannot_retrieve_reference_sequen), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_unpacking_VariantRecord, __pyx_k_Error_unpacking_VariantRecord, sizeof(__pyx_k_Error_unpacking_VariantRecord), 0, 0, 1, 0},
  {&__pyx_n_s_FILTER, __pyx_k_FILTER, sizeof(__pyx_k_FILTER), 0, 0, 1, 1},
  {&__pyx_n_s_FIXED, __pyx_k_FIXED, sizeof(__pyx_k_FIXED), 0, 0, 1, 1},
  {&__pyx_n_s_FORMAT, __pyx_k_FORMAT, sizeof(__pyx_k_FORMAT), 0, 0, 1, 1},
  {&__pyx_n_s_Flag, __pyx_k_Flag, sizeof(__pyx_k_Flag), 0, 0, 1, 1},
  {&__pyx_n_s_Float, __pyx_k_Float, sizeof(__pyx_k_Float), 0, 0, 1, 1},
  {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1},
  {&__pyx_n_s_GENERIC, __pyx_k_GENERIC, sizeof(__pyx_k_GENERIC), 0, 0, 1, 1},
  {&__pyx_n_s_GZI, __pyx_k_GZI, sizeof(__pyx_k_GZI), 0, 0, 1, 1},
  {&__pyx_n_s_GZIP, __pyx_k_GZIP, sizeof(__pyx_k_GZIP), 0, 0, 1, 1},
  {&__pyx_n_s_IDX, __pyx_k_IDX, sizeof(__pyx_k_IDX), 0, 0, 1, 1},
  {&__pyx_n_s_INDEX, __pyx_k_INDEX, sizeof(__pyx_k_INDEX), 0, 0, 1, 1},
  {&__pyx_n_s_INFO, __pyx_k_INFO, sizeof(__pyx_k_INFO), 0, 0, 1, 1},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_n_s_IS_PYTHON3, __pyx_k_IS_PYTHON3, sizeof(__pyx_k_IS_PYTHON3), 0, 0, 1, 1},
  {&__pyx_kp_s_I_O_operation_on_closed_file, __pyx_k_I_O_operation_on_closed_file, sizeof(__pyx_k_I_O_operation_on_closed_file), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_n_s_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 0, 1, 1},
  {&__pyx_kp_s_Invalid_filter, __pyx_k_Invalid_filter, sizeof(__pyx_k_Invalid_filter), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_index_object, __pyx_k_Invalid_index_object, sizeof(__pyx_k_Invalid_index_object), 0, 0, 1, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 0, 1, 1},
  {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
  {&__pyx_n_s_PASS, __pyx_k_PASS, sizeof(__pyx_k_PASS), 0, 0, 1, 1},
  {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
  {&__pyx_n_s_REGIONS, __pyx_k_REGIONS, sizeof(__pyx_k_REGIONS), 0, 0, 1, 1},
  {&__pyx_n_s_SAM, __pyx_k_SAM, sizeof(__pyx_k_SAM), 0, 0, 1, 1},
  {&__pyx_n_s_STRUCTURED, __pyx_k_STRUCTURED, sizeof(__pyx_k_STRUCTURED), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 0, 1, 1},
  {&__pyx_n_s_TBI, __pyx_k_TBI, sizeof(__pyx_k_TBI), 0, 0, 1, 1},
  {&__pyx_n_s_TEXT_FORMAT, __pyx_k_TEXT_FORMAT, sizeof(__pyx_k_TEXT_FORMAT), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UNKNOWN, __pyx_k_UNKNOWN, sizeof(__pyx_k_UNKNOWN), 0, 0, 1, 1},
  {&__pyx_kp_s_Unknown_INFO_field, __pyx_k_Unknown_INFO_field, sizeof(__pyx_k_Unknown_INFO_field), 0, 0, 1, 0},
  {&__pyx_n_s_VARIABLE, __pyx_k_VARIABLE, sizeof(__pyx_k_VARIABLE), 0, 0, 1, 1},
  {&__pyx_n_s_VARIANTS, __pyx_k_VARIANTS, sizeof(__pyx_k_VARIANTS), 0, 0, 1, 1},
  {&__pyx_n_s_VCF, __pyx_k_VCF, sizeof(__pyx_k_VCF), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_VariantFile, __pyx_k_VariantFile, sizeof(__pyx_k_VariantFile), 0, 0, 1, 1},
  {&__pyx_n_s_VariantHeader, __pyx_k_VariantHeader, sizeof(__pyx_k_VariantHeader), 0, 0, 1, 1},
  {&__pyx_n_s_VariantHeaderContigs___iter, __pyx_k_VariantHeaderContigs___iter, sizeof(__pyx_k_VariantHeaderContigs___iter), 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_itervalues, __pyx_k_VariantHeaderContigs_itervalues, sizeof(__pyx_k_VariantHeaderContigs_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantHeaderMetadata___iter, __pyx_k_VariantHeaderMetadata___iter, sizeof(__pyx_k_VariantHeaderMetadata___iter), 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_itervalues, __pyx_k_VariantHeaderMetadata_itervalues, sizeof(__pyx_k_VariantHeaderMetadata_itervalues), 0, 0, 1, 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_VariantHeaderRecords___iter, __pyx_k_VariantHeaderRecords___iter, sizeof(__pyx_k_VariantHeaderRecords___iter), 0, 0, 1, 1},
  {&__pyx_n_s_VariantHeaderSamples___iter, __pyx_k_VariantHeaderSamples___iter, sizeof(__pyx_k_VariantHeaderSamples___iter), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecordFilter___iter, __pyx_k_VariantRecordFilter___iter, sizeof(__pyx_k_VariantRecordFilter___iter), 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_itervalues, __pyx_k_VariantRecordFilter_itervalues, sizeof(__pyx_k_VariantRecordFilter_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecordFormat___iter, __pyx_k_VariantRecordFormat___iter, sizeof(__pyx_k_VariantRecordFormat___iter), 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_itervalues, __pyx_k_VariantRecordFormat_itervalues, sizeof(__pyx_k_VariantRecordFormat_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecordInfo___iter, __pyx_k_VariantRecordInfo___iter, sizeof(__pyx_k_VariantRecordInfo___iter), 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_itervalues, __pyx_k_VariantRecordInfo_itervalues, sizeof(__pyx_k_VariantRecordInfo_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecordSample___iter, __pyx_k_VariantRecordSample___iter, sizeof(__pyx_k_VariantRecordSample___iter), 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_itervalues, __pyx_k_VariantRecordSample_itervalues, sizeof(__pyx_k_VariantRecordSample_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecordSamples___iter, __pyx_k_VariantRecordSamples___iter, sizeof(__pyx_k_VariantRecordSamples___iter), 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_itervalues, __pyx_k_VariantRecordSamples_itervalues, sizeof(__pyx_k_VariantRecordSamples_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_VariantRecord___get___locals_gen, __pyx_k_VariantRecord___get___locals_gen, sizeof(__pyx_k_VariantRecord___get___locals_gen), 0, 0, 1, 1},
  {&__pyx_kp_s_Variant_read_failed, __pyx_k_Variant_read_failed, sizeof(__pyx_k_Variant_read_failed), 0, 0, 1, 0},
  {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
  {&__pyx_kp_b__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 0, 0},
  {&__pyx_kp_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 0},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
  {&__pyx_kp_b__82, __pyx_k__82, sizeof(__pyx_k__82), 0, 0, 0, 0},
  {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
  {&__pyx_kp_s_a_VariantHeader_must_be_specifie, __pyx_k_a_VariantHeader_must_be_specifie, sizeof(__pyx_k_a_VariantHeader_must_be_specifie), 0, 0, 1, 0},
  {&__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_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
  {&__pyx_n_s_bcf, __pyx_k_bcf, sizeof(__pyx_k_bcf), 0, 0, 1, 1},
  {&__pyx_kp_s_bcf_hdr_set_samples_failed_ret, __pyx_k_bcf_hdr_set_samples_failed_ret, sizeof(__pyx_k_bcf_hdr_set_samples_failed_ret), 0, 0, 1, 0},
  {&__pyx_kp_s_bcf_index_required, __pyx_k_bcf_index_required, sizeof(__pyx_k_bcf_index_required), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_create_VariantHeader, __pyx_k_cannot_create_VariantHeader, sizeof(__pyx_k_cannot_create_VariantHeader), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_create_VariantRecord, __pyx_k_cannot_create_VariantRecord, sizeof(__pyx_k_cannot_create_VariantRecord), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_create_VariantRecordSampl, __pyx_k_cannot_create_VariantRecordSampl, sizeof(__pyx_k_cannot_create_VariantRecordSampl), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_fetch_from_Variantfile_op, __pyx_k_cannot_fetch_from_Variantfile_op, sizeof(__pyx_k_cannot_fetch_from_Variantfile_op), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_iterate_over_Variantfile, __pyx_k_cannot_iterate_over_Variantfile, sizeof(__pyx_k_cannot_iterate_over_Variantfile), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_subset_samples_after_fetc, __pyx_k_cannot_subset_samples_after_fetc, sizeof(__pyx_k_cannot_subset_samples_after_fetc), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_subset_samples_from_Varia, __pyx_k_cannot_subset_samples_from_Varia, sizeof(__pyx_k_cannot_subset_samples_from_Varia), 0, 0, 1, 0},
  {&__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_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_kp_s_could_not_open_file_mode, __pyx_k_could_not_open_file_mode, sizeof(__pyx_k_could_not_open_file_mode), 0, 0, 1, 0},
  {&__pyx_kp_s_could_not_open_file_mode_is_it_V, __pyx_k_could_not_open_file_mode_is_it_V, sizeof(__pyx_k_could_not_open_file_mode_is_it_V), 0, 0, 1, 0},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_drop_samples, __pyx_k_drop_samples, sizeof(__pyx_k_drop_samples), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_kp_s_error_in_bcf_subset_format, __pyx_k_error_in_bcf_subset_format, sizeof(__pyx_k_error_in_bcf_subset_format), 0, 0, 1, 0},
  {&__pyx_kp_s_error_in_vcf_parse, __pyx_k_error_in_vcf_parse, sizeof(__pyx_k_error_in_vcf_parse), 0, 0, 1, 0},
  {&__pyx_kp_s_error_reading_BCF_file, __pyx_k_error_reading_BCF_file, sizeof(__pyx_k_error_reading_BCF_file), 0, 0, 1, 0},
  {&__pyx_kp_s_error_reading_indexed_VCF_file, __pyx_k_error_reading_indexed_VCF_file, sizeof(__pyx_k_error_reading_indexed_VCF_file), 0, 0, 1, 0},
  {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1},
  {&__pyx_n_s_exc_value, __pyx_k_exc_value, sizeof(__pyx_k_exc_value), 0, 0, 1, 1},
  {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
  {&__pyx_n_s_fetch, __pyx_k_fetch, sizeof(__pyx_k_fetch), 0, 0, 1, 1},
  {&__pyx_kp_s_fetch_requires_an_index, __pyx_k_fetch_requires_an_index, sizeof(__pyx_k_fetch_requires_an_index), 0, 0, 1, 0},
  {&__pyx_kp_s_file_does_not_have_valid_header, __pyx_k_file_does_not_have_valid_header, sizeof(__pyx_k_file_does_not_have_valid_header), 0, 0, 1, 0},
  {&__pyx_kp_s_file_not_found, __pyx_k_file_not_found, sizeof(__pyx_k_file_not_found), 0, 0, 1, 0},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_kp_b_ftp, __pyx_k_ftp, sizeof(__pyx_k_ftp), 0, 0, 0, 0},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 0, 0, 1, 1},
  {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
  {&__pyx_n_s_hash, __pyx_k_hash, sizeof(__pyx_k_hash), 0, 0, 1, 1},
  {&__pyx_n_s_header, __pyx_k_header, sizeof(__pyx_k_header), 0, 0, 1, 1},
  {&__pyx_kp_b_http, __pyx_k_http, sizeof(__pyx_k_http), 0, 0, 0, 0},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_kp_s_invalid_VariantHeader, __pyx_k_invalid_VariantHeader, sizeof(__pyx_k_invalid_VariantHeader), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_VariantRecord, __pyx_k_invalid_VariantRecord, sizeof(__pyx_k_invalid_VariantRecord), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_contig, __pyx_k_invalid_contig, sizeof(__pyx_k_invalid_contig), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_contig_id, __pyx_k_invalid_contig_id, sizeof(__pyx_k_invalid_contig_id), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_contig_index, __pyx_k_invalid_contig_index, sizeof(__pyx_k_invalid_contig_index), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_file_opening_mode, __pyx_k_invalid_file_opening_mode, sizeof(__pyx_k_invalid_file_opening_mode), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_filter, __pyx_k_invalid_filter, sizeof(__pyx_k_invalid_filter), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_filter_index, __pyx_k_invalid_filter_index, sizeof(__pyx_k_invalid_filter_index), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_format_index, __pyx_k_invalid_format_index, sizeof(__pyx_k_invalid_format_index), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_format_requested, __pyx_k_invalid_format_requested, sizeof(__pyx_k_invalid_format_requested), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_header_mode_specified, __pyx_k_invalid_header_mode_specified, sizeof(__pyx_k_invalid_header_mode_specified), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_header_record_index, __pyx_k_invalid_header_record_index, sizeof(__pyx_k_invalid_header_record_index), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_metadata_id, __pyx_k_invalid_metadata_id, sizeof(__pyx_k_invalid_metadata_id), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_metadata_type, __pyx_k_invalid_metadata_type, sizeof(__pyx_k_invalid_metadata_type), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_sample_index, __pyx_k_invalid_sample_index, sizeof(__pyx_k_invalid_sample_index), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_sample_name, __pyx_k_invalid_sample_name, sizeof(__pyx_k_invalid_sample_name), 0, 0, 1, 0},
  {&__pyx_n_s_is_open, __pyx_k_is_open, sizeof(__pyx_k_is_open), 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_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_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_kp_s_metadata_not_available_on_closed, __pyx_k_metadata_not_available_on_closed, sizeof(__pyx_k_metadata_not_available_on_closed), 0, 0, 1, 0},
  {&__pyx_kp_s_missing_d_requested_samples, __pyx_k_missing_d_requested_samples, sizeof(__pyx_k_missing_d_requested_samples), 0, 0, 1, 0},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 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_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 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_s_rU, __pyx_k_rU, sizeof(__pyx_k_rU), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 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_reopen, __pyx_k_reopen, sizeof(__pyx_k_reopen), 0, 0, 1, 1},
  {&__pyx_n_s_rw, __pyx_k_rw, sizeof(__pyx_k_rw), 0, 0, 1, 1},
  {&__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_kp_s_seek_not_available_in_streams, __pyx_k_seek_not_available_in_streams, sizeof(__pyx_k_seek_not_available_in_streams), 0, 0, 1, 0},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 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_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_str___locals_genexpr, __pyx_k_str___locals_genexpr, sizeof(__pyx_k_str___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_kp_s_tabix_index_required, __pyx_k_tabix_index_required, sizeof(__pyx_k_tabix_index_required), 0, 0, 1, 0},
  {&__pyx_kp_s_tbi, __pyx_k_tbi, sizeof(__pyx_k_tbi), 0, 0, 1, 0},
  {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
  {&__pyx_kp_s_tell_not_available_in_streams, __pyx_k_tell_not_available_in_streams, sizeof(__pyx_k_tell_not_available_in_streams), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_kp_s_truncated_file, __pyx_k_truncated_file, sizeof(__pyx_k_truncated_file), 0, 0, 1, 0},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_kp_s_unknown_format, __pyx_k_unknown_format, sizeof(__pyx_k_unknown_format), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_info_type_code, __pyx_k_unsupported_info_type_code, sizeof(__pyx_k_unsupported_info_type_code), 0, 0, 1, 0},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_kp_s_vcf_format_failed, __pyx_k_vcf_format_failed, sizeof(__pyx_k_vcf_format_failed), 0, 0, 1, 0},
  {&__pyx_n_b_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 0, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 0, 1, 1},
  {&__pyx_n_b_wb0, __pyx_k_wb0, sizeof(__pyx_k_wb0), 0, 0, 0, 1},
  {&__pyx_n_s_wb0, __pyx_k_wb0, sizeof(__pyx_k_wb0), 0, 0, 1, 1},
  {&__pyx_n_b_wbu, __pyx_k_wbu, sizeof(__pyx_k_wbu), 0, 0, 0, 1},
  {&__pyx_n_s_wbu, __pyx_k_wbu, sizeof(__pyx_k_wbu), 0, 0, 1, 1},
  {&__pyx_n_s_wh, __pyx_k_wh, sizeof(__pyx_k_wh), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_kp_s_write_failed, __pyx_k_write_failed, sizeof(__pyx_k_write_failed), 0, 0, 1, 0},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pysam/cbcf.pyx":243
 *         return filename.encode(FILENAME_ENCODING)
 *     else:
 *         raise TypeError('Argument must be string or unicode.')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Argument_must_be_string_or_unico); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "pysam/cbcf.pyx":253
 *         return s
 *     elif PyBytes_Check(s):
 *         return s.decode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         # assume unicode
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "pysam/cbcf.pyx":268
 *         return s
 *     elif PyUnicode_Check(s):
 *         return s.encode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('Argument must be string, bytes or unicode.')
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pysam/cbcf.pyx":270
 *         return s.encode('ascii')
 *     else:
 *         raise TypeError('Argument must be string, bytes or unicode.')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Argument_must_be_string_bytes_or); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pysam/cbcf.pyx":337
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 * 
 *         if not value:
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unsupported_info_type_code); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pysam/cbcf.pyx":369
 *             value = s if not s or s[0] != bcf_str_missing else None
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 *     else:
 *         value = bcf_array_to_object(z.vptr, z.type, z.len)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unsupported_info_type_code); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pysam/cbcf.pyx":428
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *h):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not h:
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "pysam/cbcf.pyx":452
 *         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__12 = PyTuple_Pack(1, __pyx_kp_s_invalid_header_record_index); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "pysam/cbcf.pyx":465
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "pysam/cbcf.pyx":522
 * 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_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "pysam/cbcf.pyx":525
 * 
 *     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__16 = PyTuple_Pack(1, __pyx_kp_s_invalid_metadata_type); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pysam/cbcf.pyx":528
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_ID]:
 *         raise ValueError('invalid metadata id')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_invalid_metadata_id); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "pysam/cbcf.pyx":571
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
 *             raise KeyError('invalid filter')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_invalid_filter); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "pysam/cbcf.pyx":634
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "pysam/cbcf.pyx":674
 * 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_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "pysam/cbcf.pyx":677
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_CTG]:
 *         raise ValueError('invalid contig id')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_invalid_contig_id); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "pysam/cbcf.pyx":706
 *             index = key
 *             if index < 0 or index >= h.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')             # <<<<<<<<<<<<<<
 *             return makeVariantContig(self.header, index)
 * 
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_invalid_contig_index); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "pysam/cbcf.pyx":713
 * 
 *         if k == kh_end(d):
 *             raise KeyError('invalid contig')             # <<<<<<<<<<<<<<
 * 
 *         cdef int id = kh_val_vdict(d, k).id
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_invalid_contig); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "pysam/cbcf.pyx":778
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderContigs contigs = VariantHeaderContigs.__new__(VariantHeaderContigs)
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "pysam/cbcf.pyx":801
 * 
 *         if i < 0 or i >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return h.samples[i]
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_invalid_sample_index); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "pysam/cbcf.pyx":828
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderSamples samples = VariantHeaderSamples.__new__(VariantHeaderSamples)
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "pysam/cbcf.pyx":856
 * 
 *         if not self.ptr:
 *             raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_cannot_create_VariantHeader); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "pysam/cbcf.pyx":934
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *h):
 *     if not h:
 *         raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader, None)
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_cannot_create_VariantHeader); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "pysam/cbcf.pyx":936
 *         raise ValueError('cannot create VariantHeader')
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader, None)             # <<<<<<<<<<<<<<
 *     header.ptr = h
 * 
 */
  __pyx_tuple__29 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "pysam/cbcf.pyx":966
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_invalid_filter_index); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "pysam/cbcf.pyx":976
 * 
 *             if not bcf_hdr_idinfo_exists(h, BCF_HL_FLT, id) or not bcf_has_filter(h, self.record.ptr, key):
 *                 raise KeyError('Invalid filter')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Invalid_filter); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "pysam/cbcf.pyx":1034
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantRecord); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "pysam/cbcf.pyx":1061
 *             index = key
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid format index')             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[index]
 *         else:
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_invalid_format_index); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "pysam/cbcf.pyx":1066
 *             fmt = bcf_get_fmt(h, r, key)
 *             if not fmt:
 *                 raise KeyError('unknown format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_unknown_format); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "pysam/cbcf.pyx":1125
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantRecord); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "pysam/cbcf.pyx":1222
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantRecord); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "pysam/cbcf.pyx":1252
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')             # <<<<<<<<<<<<<<
 * 
 *         if sample_index < 0 or sample_index >= n:
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_invalid_sample_name); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "pysam/cbcf.pyx":1255
 * 
 *         if sample_index < 0 or sample_index >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecordSample(self.record, sample_index)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_invalid_sample_index); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "pysam/cbcf.pyx":1287
 *             sample_index = bcf_hdr_id2int(h, BCF_DT_SAMPLE, key)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name')             # <<<<<<<<<<<<<<
 * 
 *         return 0 <= sample_index < n
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_invalid_sample_name); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "pysam/cbcf.pyx":1333
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSamples genos = VariantRecordSamples.__new__(VariantRecordSamples)
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantRecord); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "pysam/cbcf.pyx":1425
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             id = self.ptr.d.id
 *             return id if id != b'.' else None
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "pysam/cbcf.pyx":1433
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return self.ptr.d.allele[0] if self.ptr.d.allele else None
 * 
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "pysam/cbcf.pyx":1440
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             if not self.ptr.d.allele:
 *                 return None
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "pysam/cbcf.pyx":1449
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_STR) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             if self.ptr.n_allele < 2 or not self.ptr.d.allele:
 *                 return None
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "pysam/cbcf.pyx":1458
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return makeVariantRecordFilter(self)
 * 
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "pysam/cbcf.pyx":1465
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return makeVariantRecordInfo(self)
 * 
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "pysam/cbcf.pyx":1472
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return makeVariantRecordFormat(self)
 * 
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "pysam/cbcf.pyx":1479
 *         def __get__(self):
 *             if bcf_unpack(self.ptr, BCF_UN_IND) < 0:
 *                 raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *             return makeVariantRecordSamples(self)
 * 
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_Error_unpacking_VariantRecord); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "pysam/cbcf.pyx":1492
 *             if line.m:
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')             # <<<<<<<<<<<<<<
 * 
 *         # Strip CR/LF?
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_vcf_format_failed); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "pysam/cbcf.pyx":1512
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not r:
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "pysam/cbcf.pyx":1515
 * 
 *     if not r:
 *         raise ValueError('cannot create VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_cannot_create_VariantRecord); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "pysam/cbcf.pyx":1543
 * 
 *             if self.index < 0 or self.index >= n:
 *                 raise ValueError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *             return h.samples[self.index]
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_invalid_sample_index); if (unlikely(!__pyx_tuple__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "pysam/cbcf.pyx":1651
 *             index = key
 *             if index < 0 or index >= r.n_fmt:
 *                 raise IndexError('invalid format index')             # <<<<<<<<<<<<<<
 *             fmt = r.d.fmt + index
 *         else:
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_invalid_format_index); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "pysam/cbcf.pyx":1657
 * 
 *         if not fmt:
 *             raise KeyError('invalid format requested')             # <<<<<<<<<<<<<<
 * 
 *         if is_gt_fmt(h, fmt):
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_invalid_format_requested); if (unlikely(!__pyx_tuple__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "pysam/cbcf.pyx":1721
 * 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__55 = PyTuple_Pack(1, __pyx_kp_s_cannot_create_VariantRecordSampl); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "pysam/cbcf.pyx":1810
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_Invalid_index_object); if (unlikely(!__pyx_tuple__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "pysam/cbcf.pyx":1816
 * 
 *         if not refs:
 *             raise ValueError('Cannot retrieve reference sequence names')             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_Cannot_retrieve_reference_sequen); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "pysam/cbcf.pyx":1835
 * 
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_invalid_VariantHeader); if (unlikely(!__pyx_tuple__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "pysam/cbcf.pyx":1852
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_Invalid_index_object); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "pysam/cbcf.pyx":1858
 * 
 *         if not refs:
 *             raise ValueError('Cannot retrieve reference sequence names')             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1)
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_Cannot_retrieve_reference_sequen); if (unlikely(!__pyx_tuple__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "pysam/cbcf.pyx":1907
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef BCFIndex index = bcf.index
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_bcf_index_required); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "pysam/cbcf.pyx":1912
 * 
 *         if not index:
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_bcf_index_required); if (unlikely(!__pyx_tuple__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "pysam/cbcf.pyx":1965
 *                 raise StopIteration
 *             else:
 *                 raise ValueError('error reading BCF file')             # <<<<<<<<<<<<<<
 * 
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_kp_s_error_reading_BCF_file); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "pysam/cbcf.pyx":1971
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_s_error_in_bcf_subset_format); if (unlikely(!__pyx_tuple__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "pysam/cbcf.pyx":1984
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, region=None, reopen=True):
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef TabixIndex index = bcf.index
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_tabix_index_required); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "pysam/cbcf.pyx":1989
 * 
 *         if not index:
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_bcf_index_required); if (unlikely(!__pyx_tuple__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "pysam/cbcf.pyx":2044
 *                 raise StopIteration
 *             else:
 *                 raise ValueError('error reading indexed VCF file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
 */
  __pyx_tuple__67 = PyTuple_Pack(1, __pyx_kp_s_error_reading_indexed_VCF_file); if (unlikely(!__pyx_tuple__67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);

  /* "pysam/cbcf.pyx":2057
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
 */
  __pyx_tuple__68 = PyTuple_Pack(1, __pyx_kp_s_error_in_vcf_parse); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "pysam/cbcf.pyx":2129
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return FORMAT_CATEGORIES[self.htsfile.format.category]
 * 
 */
  __pyx_tuple__69 = PyTuple_Pack(1, __pyx_kp_s_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "pysam/cbcf.pyx":2138
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return FORMATS[self.htsfile.format.format]
 * 
 */
  __pyx_tuple__70 = PyTuple_Pack(1, __pyx_kp_s_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "pysam/cbcf.pyx":2145
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return self.htsfile.format.version.major, self.htsfile.format.version.minor
 * 
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "pysam/cbcf.pyx":2152
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             return COMPRESSION[self.htsfile.format.compression]
 * 
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_kp_s_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "pysam/cbcf.pyx":2159
 *         def __get__(self):
 *             if not self.htsfile:
 *                 raise ValueError('metadata not available on closed file')             # <<<<<<<<<<<<<<
 *             cdef char *desc = hts_format_description(&self.htsfile.format)
 *             try:
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "pysam/cbcf.pyx":2180
 *     def __iter__(self):
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
  __pyx_tuple__74 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "pysam/cbcf.pyx":2183
 * 
 *         if self.mode[0] != b'r':
 *             raise ValueError('cannot iterate over Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_kp_s_cannot_iterate_over_Variantfile); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "pysam/cbcf.pyx":2203
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('Variant read failed')
 */
  __pyx_tuple__76 = PyTuple_Pack(1, __pyx_kp_s_truncated_file); if (unlikely(!__pyx_tuple__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "pysam/cbcf.pyx":2205
 *                 raise IOError('truncated file')
 *             else:
 *                 raise ValueError('Variant read failed')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.header, record)
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_Variant_read_failed); if (unlikely(!__pyx_tuple__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "pysam/cbcf.pyx":2219
 * 
 *         if not vars.htsfile:
 *             raise ValueError('Cannot re-open htsfile')             # <<<<<<<<<<<<<<
 * 
 *         # minimize overhead by re-using header and index.  This approach is
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_kp_s_Cannot_re_open_htsfile); if (unlikely(!__pyx_tuple__78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "pysam/cbcf.pyx":2265
 *             raise ValueError('invalid file opening mode `{}`'.format(mode))
 * 
 *         mode = mode.encode('ascii')             # <<<<<<<<<<<<<<
 * 
 *         # for htslib, wbu seems to not work
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "pysam/cbcf.pyx":2276
 * 
 *         # FIXME: Use htsFormat when it is available
 *         self.is_remote = filename.startswith(b'http:') or filename.startswith(b'ftp:')             # <<<<<<<<<<<<<<
 *         self.is_stream = filename == b'-'
 * 
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_kp_b_http); if (unlikely(!__pyx_tuple__80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_b_ftp); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "pysam/cbcf.pyx":2286
 *                 self.header = header.copy()
 *             else:
 *                 raise ValueError('a VariantHeader must be specified')             # <<<<<<<<<<<<<<
 * 
 *             # open file. Header gets written to file at the same time for bam files
 */
  __pyx_tuple__83 = PyTuple_Pack(1, __pyx_kp_s_a_VariantHeader_must_be_specifie); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "pysam/cbcf.pyx":2328
 *         """move file pointer to position *offset*, see :meth:`pysam.VariantFile.tell`."""
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 *         if self.is_stream:
 *             raise OSError('seek not available in streams')
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "pysam/cbcf.pyx":2330
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 *             raise OSError('seek not available in streams')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.format.compression != no_compression:
 */
  __pyx_tuple__85 = PyTuple_Pack(1, __pyx_kp_s_seek_not_available_in_streams); if (unlikely(!__pyx_tuple__85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "pysam/cbcf.pyx":2340
 *         """return current file position, see :meth:`pysam.VariantFile.seek`."""
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 *         if self.is_stream:
 *             raise OSError('tell not available in streams')
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "pysam/cbcf.pyx":2342
 *             raise ValueError('I/O operation on closed file')
 *         if self.is_stream:
 *             raise OSError('tell not available in streams')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.format.compression != no_compression:
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_tell_not_available_in_streams); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "pysam/cbcf.pyx":2370
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "pysam/cbcf.pyx":2373
 * 
 *         if self.mode[0] != b'r':
 *             raise ValueError('cannot fetch from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if contig is None and region is None:
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_cannot_fetch_from_Variantfile_op); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "pysam/cbcf.pyx":2382
 * 
 *         if not self.index:
 *             raise ValueError('fetch requires an index')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
 */
  __pyx_tuple__90 = PyTuple_Pack(1, __pyx_kp_s_fetch_requires_an_index); if (unlikely(!__pyx_tuple__90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);

  /* "pysam/cbcf.pyx":2399
 * 
 *         if ret < 0:
 *             raise ValueError('write failed')             # <<<<<<<<<<<<<<
 * 
 *         return ret
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_kp_s_write_failed); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "pysam/cbcf.pyx":2409
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.mode[0] != b'r':
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "pysam/cbcf.pyx":2412
 * 
 *         if self.mode[0] != b'r':
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if self.is_reading:
 */
  __pyx_tuple__93 = PyTuple_Pack(1, __pyx_kp_s_cannot_subset_samples_from_Varia); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "pysam/cbcf.pyx":2415
 * 
 *         if self.is_reading:
 *             raise ValueError('cannot subset samples after fetching records')             # <<<<<<<<<<<<<<
 * 
 *         self.header._subset_samples(include_samples)
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_cannot_subset_samples_after_fetc); if (unlikely(!__pyx_tuple__94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "pysam/cbcf.pyx":208
 * 
 * cdef int   MAX_POS = 2 << 29
 * 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__95 = PyTuple_Pack(4, __pyx_n_s_Flag, __pyx_n_s_Integer, __pyx_n_s_Float, __pyx_n_s_String); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "pysam/cbcf.pyx":209
 * cdef int   MAX_POS = 2 << 29
 * 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__96 = PyTuple_Pack(6, __pyx_n_s_FILTER, __pyx_n_s_INFO, __pyx_n_s_FORMAT, __pyx_n_s_CONTIG, __pyx_n_s_STRUCTURED, __pyx_n_s_GENERIC); if (unlikely(!__pyx_tuple__96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "pysam/cbcf.pyx":210
 * 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')             # <<<<<<<<<<<<<<
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
 */
  __pyx_tuple__97 = PyTuple_Pack(5, __pyx_n_s_FIXED, __pyx_n_s_VARIABLE, __pyx_n_s_A, __pyx_n_s_G, __pyx_n_s_R); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "pysam/cbcf.pyx":212
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')             # <<<<<<<<<<<<<<
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 */
  __pyx_tuple__98 = PyTuple_Pack(5, __pyx_n_s_UNKNOWN, __pyx_n_s_ALIGNMENTS, __pyx_n_s_VARIANTS, __pyx_n_s_INDEX, __pyx_n_s_REGIONS); if (unlikely(!__pyx_tuple__98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "pysam/cbcf.pyx":213
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',             # <<<<<<<<<<<<<<
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')
 */
  __pyx_tuple__99 = PyTuple_Pack(14, __pyx_n_s_UNKNOWN, __pyx_n_s_BINARY_FORMAT, __pyx_n_s_TEXT_FORMAT, __pyx_n_s_SAM, __pyx_n_s_BAM, __pyx_n_s_BAI, __pyx_n_s_CRAM, __pyx_n_s_CRAI, __pyx_n_s_VCF, __pyx_n_s_BCF, __pyx_n_s_CSI, __pyx_n_s_GZI, __pyx_n_s_TBI, __pyx_n_s_BED); if (unlikely(!__pyx_tuple__99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "pysam/cbcf.pyx":215
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')             # <<<<<<<<<<<<<<
 * 
 * ########################################################################
 */
  __pyx_tuple__100 = PyTuple_Pack(4, __pyx_n_s_NONE, __pyx_n_s_GZIP, __pyx_n_s_BGZF, __pyx_n_s_CUSTOM); if (unlikely(!__pyx_tuple__100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcbcf(void); /*proto*/
PyMODINIT_FUNC initcbcf(void)
#else
PyMODINIT_FUNC PyInit_cbcf(void); /*proto*/
PyMODINIT_FUNC PyInit_cbcf(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #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("PyMODINIT_FUNC PyInit_cbcf(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("cbcf", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_pysam__cbcf) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "pysam.cbcf")) {
      if (unlikely(PyDict_SetItemString(modules, "pysam.cbcf", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_5pysam_4cbcf_VALUE_TYPES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_METADATA_TYPES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_METADATA_LENGTHS = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_FORMATS = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_COMPRESSION = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_4cbcf_FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5pysam_4cbcf_VariantHeader = &__pyx_vtable_5pysam_4cbcf_VariantHeader;
  __pyx_vtable_5pysam_4cbcf_VariantHeader._subset_samples = (PyObject *(*)(struct __pyx_obj_5pysam_4cbcf_VariantHeader *, PyObject *))__pyx_f_5pysam_4cbcf_13VariantHeader__subset_samples;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeader.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5pysam_4cbcf_VariantHeader.tp_dict, __pyx_vtabptr_5pysam_4cbcf_VariantHeader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "VariantHeader", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeader = &__pyx_type_5pysam_4cbcf_VariantHeader;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeaderRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeaderRecord.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantHeaderRecord", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeaderRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeaderRecord = &__pyx_type_5pysam_4cbcf_VariantHeaderRecord;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeaderRecords) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeaderRecords.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantHeaderRecords", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeaderRecords) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeaderRecords = &__pyx_type_5pysam_4cbcf_VariantHeaderRecords;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeaderContigs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeaderContigs.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantHeaderContigs", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeaderContigs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeaderContigs = &__pyx_type_5pysam_4cbcf_VariantHeaderContigs;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeaderSamples) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeaderSamples.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantHeaderSamples", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeaderSamples) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeaderSamples = &__pyx_type_5pysam_4cbcf_VariantHeaderSamples;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantContig) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantContig.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantContig", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantContig) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantContig = &__pyx_type_5pysam_4cbcf_VariantContig;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantMetadata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantMetadata.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantMetadata", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantMetadata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantMetadata = &__pyx_type_5pysam_4cbcf_VariantMetadata;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantHeaderMetadata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantHeaderMetadata.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantHeaderMetadata", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantHeaderMetadata) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata = &__pyx_type_5pysam_4cbcf_VariantHeaderMetadata;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecord.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecord", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecord = &__pyx_type_5pysam_4cbcf_VariantRecord;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecordFilter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecordFilter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecordFilter", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecordFilter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecordFilter = &__pyx_type_5pysam_4cbcf_VariantRecordFilter;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecordFormat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecordFormat.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecordFormat", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecordFormat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecordFormat = &__pyx_type_5pysam_4cbcf_VariantRecordFormat;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecordInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecordInfo.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecordInfo", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecordInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecordInfo = &__pyx_type_5pysam_4cbcf_VariantRecordInfo;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecordSamples) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecordSamples.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecordSamples", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecordSamples) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecordSamples = &__pyx_type_5pysam_4cbcf_VariantRecordSamples;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantRecordSample) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantRecordSample.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "VariantRecordSample", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantRecordSample) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantRecordSample = &__pyx_type_5pysam_4cbcf_VariantRecordSample;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_BaseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_BaseIndex.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "BaseIndex", (PyObject *)&__pyx_type_5pysam_4cbcf_BaseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_BaseIndex = &__pyx_type_5pysam_4cbcf_BaseIndex;
  __pyx_type_5pysam_4cbcf_BCFIndex.tp_base = __pyx_ptype_5pysam_4cbcf_BaseIndex;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_BCFIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_BCFIndex.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "BCFIndex", (PyObject *)&__pyx_type_5pysam_4cbcf_BCFIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_BCFIndex = &__pyx_type_5pysam_4cbcf_BCFIndex;
  __pyx_type_5pysam_4cbcf_TabixIndex.tp_base = __pyx_ptype_5pysam_4cbcf_BaseIndex;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_TabixIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_TabixIndex.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "TabixIndex", (PyObject *)&__pyx_type_5pysam_4cbcf_TabixIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_TabixIndex = &__pyx_type_5pysam_4cbcf_TabixIndex;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_BaseIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_BaseIterator.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "BaseIterator", (PyObject *)&__pyx_type_5pysam_4cbcf_BaseIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_BaseIterator = &__pyx_type_5pysam_4cbcf_BaseIterator;
  __pyx_type_5pysam_4cbcf_BCFIterator.tp_base = __pyx_ptype_5pysam_4cbcf_BaseIterator;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_BCFIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_BCFIterator.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "BCFIterator", (PyObject *)&__pyx_type_5pysam_4cbcf_BCFIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_BCFIterator = &__pyx_type_5pysam_4cbcf_BCFIterator;
  __pyx_type_5pysam_4cbcf_TabixIterator.tp_base = __pyx_ptype_5pysam_4cbcf_BaseIterator;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_TabixIterator.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_5pysam_4cbcf_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_TabixIterator = &__pyx_type_5pysam_4cbcf_TabixIterator;
  __pyx_vtabptr_5pysam_4cbcf_VariantFile = &__pyx_vtable_5pysam_4cbcf_VariantFile;
  __pyx_vtable_5pysam_4cbcf_VariantFile.write = (int (*)(struct __pyx_obj_5pysam_4cbcf_VariantFile *, struct __pyx_obj_5pysam_4cbcf_VariantRecord *, int __pyx_skip_dispatch))__pyx_f_5pysam_4cbcf_11VariantFile_write;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf_VariantFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf_VariantFile.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5pysam_4cbcf_VariantFile.tp_dict, __pyx_vtabptr_5pysam_4cbcf_VariantFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "VariantFile", (PyObject *)&__pyx_type_5pysam_4cbcf_VariantFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5pysam_4cbcf_VariantFile = &__pyx_type_5pysam_4cbcf_VariantFile;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple = &__pyx_type_5pysam_4cbcf___pyx_scope_struct____pyx_f_5pysam_4cbcf_char_array_to_tuple;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_1_genexpr.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_1_genexpr = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_2___get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_2___get__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_2___get__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_2___get__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_3_genexpr.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_3_genexpr = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_4___str__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_4___str__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_4___str__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_4___str__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_5_genexpr.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_5_genexpr = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_5_genexpr;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_6___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_6___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_6___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_6___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_7___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_7___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_7___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_8_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_8_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_8_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_8_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_9_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_9_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_9_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_9_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_10___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_10___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_10___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_10___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_11_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_11_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_11_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_11_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_12_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_12_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_12_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_12_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_13___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_13___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_13___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_13___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_14___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_14___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_14___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_14___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_15_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_15_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_15_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_15_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_16_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_16_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_16_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_16_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_17___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_17___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_17___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_17___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_18_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_18_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_18_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_18_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_19_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_19_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_19_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_19_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_20___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_20___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_20___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_20___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_21_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_21_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_21_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_21_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_22_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_22_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_22_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_22_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_23___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_23___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_23___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_23___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_24_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_24_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_24_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_24_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_25_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_25_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_25_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_25_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_26___get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_26___get__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_26___get__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_26___get__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_27_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_27_genexpr.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_27_genexpr = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_27_genexpr;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_28___get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_28___get__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_28___get__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_28___get__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_29_genexpr.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_29_genexpr = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_29_genexpr;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_30___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_30___iter__.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_30___iter__ = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_30___iter__;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_31_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_31_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_31_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_31_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_32_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_32_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_32_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_32_iteritems;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_33_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_33_itervalues.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_33_itervalues = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_33_itervalues;
  if (PyType_Ready(&__pyx_type_5pysam_4cbcf___pyx_scope_struct_34_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5pysam_4cbcf___pyx_scope_struct_34_iteritems.tp_print = 0;
  __pyx_ptype_5pysam_4cbcf___pyx_scope_struct_34_iteritems = &__pyx_type_5pysam_4cbcf___pyx_scope_struct_34_iteritems;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pysam/cbcf.pyx":188
 * from __future__ import division, print_function
 * 
 * import os             # <<<<<<<<<<<<<<
 * import sys
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":189
 * 
 * import os
 * import sys             # <<<<<<<<<<<<<<
 * 
 * from libc.string cimport strcmp
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":199
 * 
 * 
 * __all__ = ['VariantFile', 'VariantHeader']             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_VariantFile);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_VariantFile);
  __Pyx_GIVEREF(__pyx_n_s_VariantFile);
  __Pyx_INCREF(__pyx_n_s_VariantHeader);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_VariantHeader);
  __Pyx_GIVEREF(__pyx_n_s_VariantHeader);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":207
 * ########################################################################
 * 
 * cdef int   MAX_POS = 2 << 29             # <<<<<<<<<<<<<<
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
 */
  __pyx_v_5pysam_4cbcf_MAX_POS = 1073741824;

  /* "pysam/cbcf.pyx":208
 * 
 * cdef int   MAX_POS = 2 << 29
 * 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__95);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_VALUE_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_VALUE_TYPES, __pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "pysam/cbcf.pyx":209
 * cdef int   MAX_POS = 2 << 29
 * 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__96);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_METADATA_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_METADATA_TYPES, __pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "pysam/cbcf.pyx":210
 * 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')             # <<<<<<<<<<<<<<
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
 */
  __Pyx_INCREF(__pyx_tuple__97);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_METADATA_LENGTHS);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_METADATA_LENGTHS, __pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "pysam/cbcf.pyx":212
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')             # <<<<<<<<<<<<<<
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 */
  __Pyx_INCREF(__pyx_tuple__98);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_FORMAT_CATEGORIES, __pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "pysam/cbcf.pyx":213
 * 
 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',             # <<<<<<<<<<<<<<
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')
 */
  __Pyx_INCREF(__pyx_tuple__99);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_FORMATS);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_FORMATS, __pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "pysam/cbcf.pyx":215
 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
 *                       'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')             # <<<<<<<<<<<<<<
 * 
 * ########################################################################
 */
  __Pyx_INCREF(__pyx_tuple__100);
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_COMPRESSION);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_COMPRESSION, __pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "pysam/cbcf.pyx":222
 * ########################################################################
 * 
 * IS_PYTHON3 = PY_MAJOR_VERSION >= 3             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong((PY_MAJOR_VERSION >= 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IS_PYTHON3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":227
 * # filename encoding (copied from lxml.etree.pyx)
 * cdef str FILENAME_ENCODING
 * FILENAME_ENCODING = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
 * if FILENAME_ENCODING is None:
 *     FILENAME_ENCODING = sys.getdefaultencoding()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(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);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/cbcf.pyx":228
 * cdef str FILENAME_ENCODING
 * FILENAME_ENCODING = sys.getfilesystemencoding()
 * if FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
 *     FILENAME_ENCODING = sys.getdefaultencoding()
 * if FILENAME_ENCODING is None:
 */
  __pyx_t_4 = (__pyx_v_5pysam_4cbcf_FILENAME_ENCODING == ((PyObject*)Py_None));
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "pysam/cbcf.pyx":229
 * FILENAME_ENCODING = sys.getfilesystemencoding()
 * if FILENAME_ENCODING is None:
 *     FILENAME_ENCODING = sys.getdefaultencoding()             # <<<<<<<<<<<<<<
 * if FILENAME_ENCODING is None:
 *     FILENAME_ENCODING = 'ascii'
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_getdefaultencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
    __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "pysam/cbcf.pyx":230
 * if FILENAME_ENCODING is None:
 *     FILENAME_ENCODING = sys.getdefaultencoding()
 * if FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
 *     FILENAME_ENCODING = 'ascii'
 * 
 */
  __pyx_t_5 = (__pyx_v_5pysam_4cbcf_FILENAME_ENCODING == ((PyObject*)Py_None));
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "pysam/cbcf.pyx":231
 *     FILENAME_ENCODING = sys.getdefaultencoding()
 * if FILENAME_ENCODING is None:
 *     FILENAME_ENCODING = 'ascii'             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_INCREF(__pyx_n_s_ascii);
    __Pyx_XGOTREF(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING);
    __Pyx_DECREF_SET(__pyx_v_5pysam_4cbcf_FILENAME_ENCODING, __pyx_n_s_ascii);
    __Pyx_GIVEREF(__pyx_n_s_ascii);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysam/cbcf.pyx":460
 *             yield makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantHeaderRecords->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantHeaderRecords);

  /* "pysam/cbcf.pyx":627
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantHeaderMetadata);

  /* "pysam/cbcf.pyx":771
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantHeaderContigs->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantHeaderContigs);

  /* "pysam/cbcf.pyx":821
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantHeaderSamples->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantHeaderSamples);

  /* "pysam/cbcf.pyx":1027
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantRecordFilter->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantRecordFilter);

  /* "pysam/cbcf.pyx":1118
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantRecordFormat->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantRecordFormat);

  /* "pysam/cbcf.pyx":1215
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantRecordInfo->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantRecordInfo);

  /* "pysam/cbcf.pyx":1326
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantRecordSamples->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantRecordSamples);

  /* "pysam/cbcf.pyx":1714
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_VariantRecordSample->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_VariantRecordSample);

  /* "pysam/cbcf.pyx":1798
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5pysam_4cbcf_BaseIndex->tp_dict, __pyx_n_s_hash, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_5pysam_4cbcf_BaseIndex);

  /* "pysam/cbcf.pyx":1
 * # cython: embedsignature=True             # <<<<<<<<<<<<<<
 * # cython: profile=True
 * ###############################################################################
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pysam.cbcf", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pysam.cbcf");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

#if CYTHON_PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno) {
    int retval;
    PyThreadState* tstate = PyThreadState_GET();
    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
    }
    (*frame)->f_lineno = firstlineno;
    tstate->use_tracing = 0;
    #if CYTHON_TRACE
    if (tstate->c_tracefunc)
        tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL);
    if (!tstate->c_profilefunc)
        retval = 1;
    else
    #endif
        retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
    tstate->use_tracing = (tstate->c_profilefunc ||
                           (CYTHON_TRACE && tstate->c_tracefunc));
    return tstate->use_tracing && retval;
}
static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyCodeObject *py_code = 0;
    #if PY_MAJOR_VERSION < 3
    py_funcname = PyString_FromString(funcname);
    py_srcfile = PyString_FromString(srcfile);
    #else
    py_funcname = PyUnicode_FromString(funcname);
    py_srcfile = PyUnicode_FromString(srcfile);
    #endif
    if (!py_funcname | !py_srcfile) goto bad;
    py_code = PyCode_New(
        0,
        #if PY_MAJOR_VERSION >= 3
        0,
        #endif
        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,*/
        firstlineno,
        __pyx_empty_bytes      /*PyObject *lnotab*/
    );
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return py_code;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    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);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *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_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) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        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 PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        length = strlen(cstring);
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    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_COMPILING_IN_CPYTHON
    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;
    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;
}

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    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;
#else
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
#endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    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;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            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);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

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

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, 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,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, 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, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (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((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

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

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");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = 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
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        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_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
}

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

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
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        if (default_value == Py_None)
            default_value = NULL;
        value = PyObject_CallMethodObjArgs(
            d, __pyx_n_s_get, key, default_value, NULL);
    }
#endif
    return value;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

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

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
    const int32_t neg_one = (int32_t) -1, const_zero = 0;
    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);
        } else if (sizeof(int32_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int32_t),
                                     little, !is_unsigned);
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        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 (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
    const uint64_t neg_one = (uint64_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(uint64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(uint64_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(uint64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(uint64_t, long, PyLong_AsLong(x))
            } else if (sizeof(uint64_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(uint64_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint64_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint64_t) -1;
        }
    } else {
        uint64_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (uint64_t) -1;
        val = __Pyx_PyInt_As_uint64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint64_t");
    return (uint64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint64_t");
    return (uint64_t) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int8_t(int8_t value) {
    const int8_t neg_one = (int8_t) -1, const_zero = 0;
    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);
        } else if (sizeof(int8_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int8_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int8_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int8_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int16_t(int16_t value) {
    const int16_t neg_one = (int16_t) -1, const_zero = 0;
    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);
        } else if (sizeof(int16_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int16_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int16_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
    const int32_t neg_one = (int32_t) -1, const_zero = 0;
    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;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int32_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, long, PyLong_AsLong(x))
            } else if (sizeof(int32_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int32_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int32_t) -1;
        }
    } else {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyInt_As_int32_t(tmp);
        Py_DECREF(tmp);
        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;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = 0;
    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;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(uint32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(uint32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, long, PyLong_AsLong(x))
            } else if (sizeof(uint32_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint32_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint32_t) -1;
        }
    } else {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyInt_As_uint32_t(tmp);
        Py_DECREF(tmp);
        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;
}

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
    const short neg_one = (short) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(short) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(short) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(short) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(short),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
    const int64_t neg_one = (int64_t) -1, const_zero = 0;
    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;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int64_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int64_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int64_t, long, PyLong_AsLong(x))
            } else if (sizeof(int64_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int64_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        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;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
    const int64_t neg_one = (int64_t) -1, const_zero = 0;
    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);
        } else if (sizeof(int64_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (unlikely(et != PyExc_StopIteration) &&
            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_IsInstance(ev, 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 = PyObject_GetAttr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PyObject_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;
}
#endif
static CYTHON_INLINE
void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyThreadState *tstate = PyThreadState_GET();
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Generator_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Generator_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Send(yf, value);
        } else {
            if (value == Py_None)
                ret = PyIter_Next(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, value);
}
static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Generator_Close(yf);
        if (!retval)
            return -1;
    } else {
        PyObject *meth;
        gen->is_running = 1;
        meth = PyObject_GetAttr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Close(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Generator_CloseIter(gen, yf);
        __Pyx_Generator_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Generator_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Generator_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Generator_Undelegate(gen);
            if (err < 0)
                return __Pyx_Generator_SendEx(gen, NULL);
            goto throw_here;
        }
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Throw(yf, args);
        } else {
            PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Generator_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Generator_FinishDelegation(gen);
        }
        return ret;
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Generator_SendEx(gen, NULL);
}
static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Generator_clear(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) 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
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Generator_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Generator_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Generator_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _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_Generator_get_name(__pyx_GeneratorObject *self)
{
    Py_INCREF(self->gi_name);
    return self->gi_name;
}
static int
__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self)
{
    Py_INCREF(self->gi_qualname);
    return self->gi_qualname;
}
static int
__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
    {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
    {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_GeneratorObject),
    0,
    (destructor) __Pyx_Generator_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Generator_traverse,
    0,
    0,
    offsetof(__pyx_GeneratorObject, 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 PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Generator_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Generator_del,
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure, PyObject *name, PyObject *qualname) {
    __pyx_GeneratorObject *gen =
        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    PyObject_GC_Track(gen);
    return gen;
}
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (__pyx_GeneratorType == NULL) {
        return -1;
    }
    return 0;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE 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)) {
#if PY_VERSION_HEX < 0x03030000
        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
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (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
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    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 PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  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)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
