/* Generated by Cython 0.29.21 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "name": "cPyUSBTMC", 
        "sources": [
            "cPyUSBTMC.pyx"
        ]
    }, 
    "module_name": "cPyUSBTMC"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#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 < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_21"
#define CYTHON_HEX_VERSION 0x001D15F0
#define CYTHON_FUTURE_DIVISION 0
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#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_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

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

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #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"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #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)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #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)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #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]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define 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) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__cPyUSBTMC
#define __PYX_HAVE_API__cPyUSBTMC
/* Early includes */
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
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);
}
#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_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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*) "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) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


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

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
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[] = {
  "cPyUSBTMC.pyx",
};

/*--- Type declarations ---*/
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults {
  PyObject *__pyx_arg_transferSize;
};

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#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)

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

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

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

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

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

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

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

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

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

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

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

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

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

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

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

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

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

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

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

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

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

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

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

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

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

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

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

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

/* IncludeStringH.proto */
#include <string.h>

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

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

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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

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

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

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

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

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

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

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

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

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

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

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

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_SubtractObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

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

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

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

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

/* ClassMethod.proto */
#include "descrobject.h"
static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

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

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

/* Print.proto */
static int __Pyx_Print(PyObject*, PyObject *, int);
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

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

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

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


/* Module declarations from 'cPyUSBTMC' */
#define __Pyx_MODULE_NAME "cPyUSBTMC"
extern int __pyx_module_is_main_cPyUSBTMC;
int __pyx_module_is_main_cPyUSBTMC = 0;

/* Implementation of 'cPyUSBTMC' */
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static const char __pyx_k_B[] = "B";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "%s\000\000\000\000\000\000\000\000";
static const char __pyx_k_t[] = "t";
static const char __pyx_k__3[] = "";
static const char __pyx_k__4[] = "\n";
static const char __pyx_k__5[] = "\000";
static const char __pyx_k__9[] = ",";
static const char __pyx_k_ep[] = "ep";
static const char __pyx_k_gp[] = "gp";
static const char __pyx_k_hl[] = "hl";
static const char __pyx_k_nd[] = "nd";
static const char __pyx_k_rv[] = "rv";
static const char __pyx_k_sb[] = "sb";
static const char __pyx_k_sn[] = "sn";
static const char __pyx_k_wf[] = "wf";
static const char __pyx_k_x0[] = "x0";
static const char __pyx_k_ACQ[] = ":ACQ?\n";
static const char __pyx_k_CAL[] = "*CAL?\n";
static const char __pyx_k_CLS[] = "*CLS\n";
static const char __pyx_k_DCL[] = "*DCL\n";
static const char __pyx_k_DDT[] = "*DDT?\n";
static const char __pyx_k_DMC[] = "*DMC\n";
static const char __pyx_k_DT1[] = "DT1";
static const char __pyx_k_EMC[] = "*EMC?\n";
static const char __pyx_k_ESB[] = "ESB";
static const char __pyx_k_ESE[] = "*ESE?;\n";
static const char __pyx_k_ESQ[] = "*ESQ?;\n";
static const char __pyx_k_ESR[] = "ESR";
static const char __pyx_k_GMC[] = "*GMC?\n";
static const char __pyx_k_IDN[] = "*IDN?\n";
static const char __pyx_k_LMC[] = "*LMC?\n";
static const char __pyx_k_LRN[] = "*LRN?\n";
static const char __pyx_k_MAV[] = "MAV";
static const char __pyx_k_MSG[] = "MSG";
static const char __pyx_k_OPC[] = "*OPC?;\n";
static const char __pyx_k_OPT[] = "*OPT?\n";
static const char __pyx_k_PSC[] = "*PSC?\n";
static const char __pyx_k_PUD[] = "*PUD\n";
static const char __pyx_k_RCL[] = "*RCL\n";
static const char __pyx_k_RDT[] = "*RDT?\n";
static const char __pyx_k_RL1[] = "RL1";
static const char __pyx_k_RMC[] = "*RMC\n";
static const char __pyx_k_RST[] = "*RST;\n";
static const char __pyx_k_SAD[] = "SAD";
static const char __pyx_k_SAV[] = "*SAV\n";
static const char __pyx_k_SBR[] = "SBR";
static const char __pyx_k_SDS[] = "*SDS";
static const char __pyx_k_SR1[] = "SR1";
static const char __pyx_k_SRE[] = "*SRE?;\n";
static const char __pyx_k_STB[] = "*STB?;\n";
static const char __pyx_k_TER[] = "*TER?\n";
static const char __pyx_k_TRG[] = "TRG";
static const char __pyx_k_TST[] = "*TST?\n";
static const char __pyx_k_USR[] = "USR";
static const char __pyx_k_WAI[] = "*WAI\n";
static const char __pyx_k_WAV[] = ":WAV?\n";
static const char __pyx_k__14[] = "*";
static const char __pyx_k_ask[] = "ask";
static const char __pyx_k_buf[] = "buf";
static const char __pyx_k_cfg[] = "cfg";
static const char __pyx_k_clf[] = "clf";
static const char __pyx_k_cls[] = "cls";
static const char __pyx_k_cmd[] = "cmd";
static const char __pyx_k_cnf[] = "cnf";
static const char __pyx_k_del[] = "__del__";
static const char __pyx_k_dev[] = "dev";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_eof[] = "eof";
static const char __pyx_k_eom[] = "eom";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_raw[] = "raw";
static const char __pyx_k_res[] = "res";
static const char __pyx_k_s_2[] = "s";
static const char __pyx_k_s_s[] = "%s%s";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_usb[] = "usb";
static const char __pyx_k_wf2[] = "wf2";
static const char __pyx_k_DATA[] = ":DATA?\n";
static const char __pyx_k_DATE[] = ":DATE?\n";
static const char __pyx_k_Done[] = "Done";
static const char __pyx_k_MEAS[] = ":MEAS?\n";
static const char __pyx_k_OPER[] = "OPER";
static const char __pyx_k_SCPI[] = "SCPI";
static const char __pyx_k_STOP[] = ":STOP\n";
static const char __pyx_k_TRIG[] = ":TRIG?\n";
static const char __pyx_k_ask0[] = "ask0";
static const char __pyx_k_askS[] = "askS";
static const char __pyx_k_attr[] = "attr";
static const char __pyx_k_bTag[] = "bTag";
static const char __pyx_k_btag[] = "btag";
static const char __pyx_k_byte[] = "byte";
static const char __pyx_k_core[] = "core";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_devs[] = "devs";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_find[] = "find";
static const char __pyx_k_flag[] = "flag";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_intf[] = "intf";
static const char __pyx_k_last[] = "last";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mask[] = "mask";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_plot[] = "plot";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_resp[] = "resp";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_show[] = "show";
static const char __pyx_k_test[] = "test";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_util[] = "util";
static const char __pyx_k_vers[] = "vers";
static const char __pyx_k_ALARM[] = ":ALARM?\n";
static const char __pyx_k_CAL_2[] = "CAL";
static const char __pyx_k_CHAN1[] = ":CHAN1?\n";
static const char __pyx_k_CLS_2[] = "CLS";
static const char __pyx_k_CURVE[] = "CURVE?";
static const char __pyx_k_DCL_2[] = "DCL";
static const char __pyx_k_DDT_2[] = "*DDT\n";
static const char __pyx_k_DDT_3[] = "DDT";
static const char __pyx_k_DMC_2[] = "DMC";
static const char __pyx_k_EMC_2[] = "*EMC\n";
static const char __pyx_k_EMC_3[] = "EMC";
static const char __pyx_k_ESE_2[] = "*ESE;\n";
static const char __pyx_k_ESE_3[] = "ESE";
static const char __pyx_k_GMC_2[] = "GMC";
static const char __pyx_k_IDN_2[] = "*IDN?;\n";
static const char __pyx_k_IDN_3[] = "*IDN?;";
static const char __pyx_k_IDN_4[] = "IDN";
static const char __pyx_k_LMC_2[] = "LMC";
static const char __pyx_k_LRN_2[] = "LRN";
static const char __pyx_k_OPC_2[] = "*OPC;\n";
static const char __pyx_k_OPC_3[] = "OPC";
static const char __pyx_k_OPT_2[] = "OPT";
static const char __pyx_k_PSC_2[] = "*PSC\n";
static const char __pyx_k_PSC_3[] = "PSC";
static const char __pyx_k_PUD_2[] = "PUD";
static const char __pyx_k_RCL_2[] = "RCL";
static const char __pyx_k_RDT_2[] = "*RDT";
static const char __pyx_k_RDT_3[] = "RDT";
static const char __pyx_k_RMC_2[] = "RMC";
static const char __pyx_k_RST_2[] = "*RST\n";
static const char __pyx_k_RST_3[] = "RST";
static const char __pyx_k_SAV_2[] = "SAV";
static const char __pyx_k_SDS_2[] = "SDS";
static const char __pyx_k_SRE_2[] = "SRE";
static const char __pyx_k_SRE_d[] = "*SRE %d;\n";
static const char __pyx_k_STB_2[] = "STB";
static const char __pyx_k_TER_2[] = "TER";
static const char __pyx_k_TRG_2[] = "*TRG\n";
static const char __pyx_k_TST_2[] = "TST";
static const char __pyx_k_WAI_2[] = "WAI";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_bytes[] = "bytes";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_maker[] = "maker";
static const char __pyx_k_model[] = "model";
static const char __pyx_k_msgID[] = "msgID";
static const char __pyx_k_msgid[] = "msgid";
static const char __pyx_k_ndata[] = "ndata";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_pylab[] = "pylab";
static const char __pyx_k_query[] = "query";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_read0[] = "read0";
static const char __pyx_k_readS[] = "readS";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_rsize[] = "rsize";
static const char __pyx_k_s_s_s[] = "%s%s%s";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_title[] = "title";
static const char __pyx_k_tsize[] = "tsize";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_Device[] = "Device";
static const char __pyx_k_FAILED[] = "FAILED";
static const char __pyx_k_Failed[] = "Failed";
static const char __pyx_k_USB488[] = "USB488";
static const char __pyx_k_device[] = "device";
static const char __pyx_k_enable[] = "enable";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_points[] = "points";
static const char __pyx_k_resMsg[] = "resMsg";
static const char __pyx_k_signal[] = "signal";
static const char __pyx_k_stdout[] = "stdout";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_test_2[] = "__test__";
static const char __pyx_k_tmcdev[] = "tmcdev";
static const char __pyx_k_usbdev[] = "usbdev";
static const char __pyx_k_wIndex[] = "wIndex";
static const char __pyx_k_wValue[] = "wValue";
static const char __pyx_k_xlabel[] = "xlabel";
static const char __pyx_k_ylabel[] = "ylabel";
static const char __pyx_k_CONTROL[] = ":CONTROL?\n";
static const char __pyx_k_CTRL_IN[] = "CTRL_IN";
static const char __pyx_k_Gnuplot[] = "Gnuplot";
static const char __pyx_k_PENDING[] = "PENDING";
static const char __pyx_k_Pending[] = "Pending";
static const char __pyx_k_RQS_MSS[] = "RQS_MSS";
static const char __pyx_k_SREmask[] = "SREmask";
static const char __pyx_k_SUCCESS[] = "SUCCESS";
static const char __pyx_k_Success[] = "Success";
static const char __pyx_k_TRIGGER[] = "TRIGGER";
static const char __pyx_k_bulk_in[] = "bulk_in";
static const char __pyx_k_command[] = "command";
static const char __pyx_k_control[] = "control";
static const char __pyx_k_ep_type[] = "ep_type";
static const char __pyx_k_intr_in[] = "intr_in";
static const char __pyx_k_maxsize[] = "maxsize";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_timeout[] = "timeout";
static const char __pyx_k_usbctrl[] = "usbctrl";
static const char __pyx_k_usbdevs[] = "usbdevs";
static const char __pyx_k_0x_2x_2x[] = "0x%.2x%.2x";
static const char __pyx_k_1c_1c_1c[] = "%1c%1c%1c\000";
static const char __pyx_k_CTRL_OUT[] = "CTRL_OUT";
static const char __pyx_k_Reserved[] = "Reserved";
static const char __pyx_k_TermChar[] = "TermChar";
static const char __pyx_k_USBError[] = "USBError";
static const char __pyx_k_WAV_DATA[] = ":WAV:DATA?";
static const char __pyx_k_WAV_SEND[] = ":WAV:SEND?\n";
static const char __pyx_k_aborting[] = "aborting\n";
static const char __pyx_k_bRequest[] = "bRequest";
static const char __pyx_k_bulk_out[] = "bulk_out";
static const char __pyx_k_find_all[] = "find_all";
static const char __pyx_k_idVendor[] = "idVendor";
static const char __pyx_k_isUSB488[] = "isUSB488";
static const char __pyx_k_max_size[] = "max_size";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_raw_resp[] = "raw_resp";
static const char __pyx_k_termChar[] = "termChar";
static const char __pyx_k_termchar[] = "termchar";
static const char __pyx_k_tostring[] = "tostring";
static const char __pyx_k_usb_core[] = "usb.core";
static const char __pyx_k_usb_util[] = "usb.util";
static const char __pyx_k_GoToLocal[] = "GoToLocal";
static const char __pyx_k_SL1K_test[] = "SL1K_test";
static const char __pyx_k_TEST_MODE[] = "TEST_MODE";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_attribute[] = "attribute";
static const char __pyx_k_bInterval[] = "bInterval";
static const char __pyx_k_bTag_last[] = "bTag.last";
static const char __pyx_k_bTag_next[] = "bTag.next";
static const char __pyx_k_bcdUSB488[] = "bcdUSB488";
static const char __pyx_k_bcdUSBTMC[] = "bcdUSBTMC";
static const char __pyx_k_cPyUSBTMC[] = "cPyUSBTMC";
static const char __pyx_k_check_SRQ[] = "check_SRQ";
static const char __pyx_k_direction[] = "direction";
static const char __pyx_k_init_data[] = "__init_data__";
static const char __pyx_k_is_usbtmc[] = "is_usbtmc";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_recipient[] = "recipient";
static const char __pyx_k_remaining[] = "remaining";
static const char __pyx_k_retry_buf[] = "retry_buf";
static const char __pyx_k_talk_only[] = "talk_only";
static const char __pyx_k_term_char[] = "term_char";
static const char __pyx_k_AFG3K_test[] = "AFG3K_test";
static const char __pyx_k_DPO3K_test[] = "DPO3K_test";
static const char __pyx_k_DPO4K_test[] = "DPO4K_test";
static const char __pyx_k_DSO6K_test[] = "DSO6K_test";
static const char __pyx_k_GOTO_LOCAL[] = "GOTO_LOCAL";
static const char __pyx_k_WAV_LENGTH[] = ":WAV:LENGTH?";
static const char __pyx_k_WAV_POINTS[] = ":WAV:POINTS?\n";
static const char __pyx_k_clear_halt[] = "clear_halt";
static const char __pyx_k_get_status[] = "get_status";
static const char __pyx_k_io_timeout[] = "io_timeout";
static const char __pyx_k_DAT_ENC_SRP[] = "DAT:ENC SRP\n";
static const char __pyx_k_DAT_SOU_CH1[] = "DAT:SOU CH1\n";
static const char __pyx_k_ENDPOINT_IN[] = "ENDPOINT_IN";
static const char __pyx_k_REN_CONTROL[] = "REN_CONTROL";
static const char __pyx_k_USBTMCError[] = "USBTMCError";
static const char __pyx_k_WAV_POINT_s[] = "WAV:POINT = %s \n";
static const char __pyx_k_WAV_TRACE_1[] = "WAV:TRACE 1\n";
static const char __pyx_k_bTagInverse[] = "bTagInverse";
static const char __pyx_k_device_read[] = "device_read";
static const char __pyx_k_listen_only[] = "listen_only";
static const char __pyx_k_requestSize[] = "requestSize";
static const char __pyx_k_statusBytes[] = "statusBytes";
static const char __pyx_k_talk_only_2[] = "talk only,";
static const char __pyx_k_usb_control[] = "usb.control";
static const char __pyx_k_vender_read[] = "vender_read";
static const char __pyx_k_DAT_ENC_ASCI[] = "DAT:ENC ASCI\n";
static const char __pyx_k_ENDPOINT_OUT[] = "ENDPOINT_OUT";
static const char __pyx_k_FUNCTION_SIN[] = "FUNCTION SIN\n";
static const char __pyx_k_LocalLockOut[] = "LocalLockOut";
static const char __pyx_k_RemoteEnable[] = "RemoteEnable";
static const char __pyx_k_TransferSize[] = "TransferSize";
static const char __pyx_k_USBTMC_MsgID[] = "USBTMC_MsgID";
static const char __pyx_k_WFMO_BYT_N_1[] = "WFMO:BYT_N 1\n";
static const char __pyx_k_bmAttributes[] = "bmAttributes";
static const char __pyx_k_capabilities[] = "capabilities";
static const char __pyx_k_custom_match[] = "custom_match";
static const char __pyx_k_device_write[] = "device_write";
static const char __pyx_k_getendpoints[] = "getendpoints";
static const char __pyx_k_lock_timeout[] = "lock_timeout";
static const char __pyx_k_termCharFlag[] = "termCharFlag";
static const char __pyx_k_transferSize[] = "transferSize";
static const char __pyx_k_vender_write[] = "vender_write";
static const char __pyx_k_BulkIn_Header[] = "BulkIn_Header";
static const char __pyx_k_ENDPOINT_HALT[] = "ENDPOINT_HALT";
static const char __pyx_k_LOCAL_LOCKOUT[] = "LOCAL_LOCKOUT";
static const char __pyx_k_USB488_Status[] = "USB488_Status";
static const char __pyx_k_USB488_device[] = "USB488_device";
static const char __pyx_k_USBTMC_Status[] = "USBTMC_Status";
static const char __pyx_k_USBTMC_device[] = "USBTMC_device";
static const char __pyx_k_USBTMC_status[] = "USBTMC_status";
static const char __pyx_k_abort_bulk_in[] = "abort_bulk_in";
static const char __pyx_k_bNumEndpoints[] = "bNumEndpoints";
static const char __pyx_k_bmRequestType[] = "bmRequestType";
static const char __pyx_k_cPyUSBTMC_pyx[] = "cPyUSBTMC.pyx";
static const char __pyx_k_ctrl_transfer[] = "ctrl_transfer";
static const char __pyx_k_listen_only_2[] = "listen only,";
static const char __pyx_k_num_endpoints[] = "num_endpoints";
static const char __pyx_k_s_1c_1c_1c_1c[] = "%s%1c%1c%1c%1c\001\000\000\000";
static const char __pyx_k_DATA_DATA_EMEM[] = "DATA:DATA? EMEM\n";
static const char __pyx_k_DEV_DEP_MSG_IN[] = "DEV_DEP_MSG_IN";
static const char __pyx_k_FREQUENCY_10E3[] = "FREQUENCY 10E3\n";
static const char __pyx_k_INITIATE_CLEAR[] = "INITIATE_CLEAR";
static const char __pyx_k_TermCharEnable[] = "TermCharEnable";
static const char __pyx_k_USB488_REQUEST[] = "USB488_REQUEST";
static const char __pyx_k_USBTMC_REQUEST[] = "USBTMC_REQUEST";
static const char __pyx_k_WAV_SOURCE_CH1[] = ":WAV:SOURCE CH1;\n";
static const char __pyx_k_WAV_SOURCE_CH2[] = ":WAV:SOURCE CH2;\n";
static const char __pyx_k_abort_bulk_out[] = "abort_bulk_out";
static const char __pyx_k_bTag__lastbtag[] = "_bTag__lastbtag";
static const char __pyx_k_last_read_bTag[] = "last_read_bTag";
static const char __pyx_k_mkCommonHeader[] = "mkCommonHeader";
static const char __pyx_k_usb_get_status[] = "usb_get_status";
static const char __pyx_k_wMaxPacketSize[] = "wMaxPacketSize";
static const char __pyx_k_CTRL_TYPE_CLASS[] = "CTRL_TYPE_CLASS";
static const char __pyx_k_DEV_DEP_MSG_OUT[] = "DEV_DEP_MSG_OUT";
static const char __pyx_k_DevDep_Responce[] = "DevDep_Responce";
static const char __pyx_k_INDICATOR_PULSE[] = "INDICATOR_PULSE";
static const char __pyx_k_Not_Implemented[] = "Not Implemented";
static const char __pyx_k_StandardFeature[] = "StandardFeature";
static const char __pyx_k_WAV_FORMAT_BYTE[] = "WAV:FORMAT BYTE\n";
static const char __pyx_k_bInterfaceClass[] = "bInterfaceClass";
static const char __pyx_k_data_or_wLength[] = "data_or_wLength";
static const char __pyx_k_default_timeout[] = "default_timeout";
static const char __pyx_k_find_descriptor[] = "find_descriptor";
static const char __pyx_k_indicator_pulse[] = "indicator_pulse";
static const char __pyx_k_last_write_bTag[] = "last_write_bTag";
static const char __pyx_k_mkTriggerHeader[] = "mkTriggerHeader";
static const char __pyx_k_s_1c_1c_1c_1c_2[] = "%s%1c%1c%1c%1c\000\000\000\000";
static const char __pyx_k_termchar_enable[] = "termchar_enable";
static const char __pyx_k_AFG3K_setup_test[] = "AFG3K_setup_test";
static const char __pyx_k_CTRL_TYPE_VENDOR[] = "CTRL_TYPE_VENDOR";
static const char __pyx_k_DESC_TYPE_CONFIG[] = "DESC_TYPE_CONFIG";
static const char __pyx_k_DESC_TYPE_DEVICE[] = "DESC_TYPE_DEVICE";
static const char __pyx_k_DESC_TYPE_STRING[] = "DESC_TYPE_STRING";
static const char __pyx_k_DSO6K_test_pylab[] = "DSO6K_test_pylab";
static const char __pyx_k_GET_CAPABILITIES[] = "GET_CAPABILITIES";
static const char __pyx_k_Mandatory_LANGID[] = "Mandatory_LANGID";
static const char __pyx_k_READ_STATUS_BYTE[] = "READ_STATUS_BYTE";
static const char __pyx_k_Read_Status_Byte[] = "Read_Status_Byte";
static const char __pyx_k_bEndpointAddress[] = "bEndpointAddress";
static const char __pyx_k_dispose_resoruce[] = "dispose_resoruce";
static const char __pyx_k_find_tmc_devices[] = "find_tmc_devices";
static const char __pyx_k_get_capabilities[] = "get_capabilities";
static const char __pyx_k_s_1c_1c_1c_1c_1c[] = "%s%1c%1c%1c%1c\002%1c\000\000";
static const char __pyx_k_usbtmc_attribute[] = "usbtmc_attribute";
static const char __pyx_k_ENDPOINT_DIR_MASK[] = "ENDPOINT_DIR_MASK";
static const char __pyx_k_ENDPOINT_TYPE_ISO[] = "ENDPOINT_TYPE_ISO";
static const char __pyx_k_GetExecuteTrigger[] = "GetExecuteTrigger";
static const char __pyx_k_INTERRUPT_IN_BUSY[] = "INTERRUPT_IN_BUSY";
static const char __pyx_k_Interrupt_IN_Data[] = "Interrupt_IN_Data";
static const char __pyx_k_Interrupt_in_busy[] = "Interrupt in busy";
static const char __pyx_k_PHASE_ADJUST_0DEG[] = "PHASE:ADJUST 0DEG\n";
static const char __pyx_k_REQ_CLEAR_FEATURE[] = "REQ_CLEAR_FEATURE";
static const char __pyx_k_SPLIT_IN_PROGRESS[] = "SPLIT_IN_PROGRESS";
static const char __pyx_k_Split_in_progress[] = "Split in progress";
static const char __pyx_k_USB488_Status_msg[] = "USB488_Status.msg";
static const char __pyx_k_USB488_device_CAL[] = "USB488_device.CAL";
static const char __pyx_k_USB488_device_CLS[] = "USB488_device.CLS";
static const char __pyx_k_USB488_device_DCL[] = "USB488_device.DCL";
static const char __pyx_k_USB488_device_DDT[] = "USB488_device.DDT";
static const char __pyx_k_USB488_device_DMC[] = "USB488_device.DMC";
static const char __pyx_k_USB488_device_EMC[] = "USB488_device.EMC";
static const char __pyx_k_USB488_device_ESE[] = "USB488_device.ESE";
static const char __pyx_k_USB488_device_ESR[] = "USB488_device.ESR";
static const char __pyx_k_USB488_device_GMC[] = "USB488_device.GMC";
static const char __pyx_k_USB488_device_IDN[] = "USB488_device.IDN";
static const char __pyx_k_USB488_device_LMC[] = "USB488_device.LMC";
static const char __pyx_k_USB488_device_LRN[] = "USB488_device.LRN";
static const char __pyx_k_USB488_device_OPC[] = "USB488_device.OPC";
static const char __pyx_k_USB488_device_OPT[] = "USB488_device.OPT";
static const char __pyx_k_USB488_device_PSC[] = "USB488_device.PSC";
static const char __pyx_k_USB488_device_PUD[] = "USB488_device.PUD";
static const char __pyx_k_USB488_device_RCL[] = "USB488_device.RCL";
static const char __pyx_k_USB488_device_RDT[] = "USB488_device.RDT";
static const char __pyx_k_USB488_device_RMC[] = "USB488_device.RMC";
static const char __pyx_k_USB488_device_RST[] = "USB488_device.RST";
static const char __pyx_k_USB488_device_SAD[] = "USB488_device.SAD";
static const char __pyx_k_USB488_device_SAV[] = "USB488_device.SAV";
static const char __pyx_k_USB488_device_SDS[] = "USB488_device.SDS";
static const char __pyx_k_USB488_device_SRE[] = "USB488_device.SRE";
static const char __pyx_k_USB488_device_STB[] = "USB488_device.STB";
static const char __pyx_k_USB488_device_TER[] = "USB488_device.TER";
static const char __pyx_k_USB488_device_TRG[] = "USB488_device.TRG";
static const char __pyx_k_USB488_device_TST[] = "USB488_device.TST";
static const char __pyx_k_USB488_device_WAI[] = "USB488_device.WAI";
static const char __pyx_k_USBTMC_Status_msg[] = "USBTMC_Status.msg";
static const char __pyx_k_USBTMC_device_ask[] = "USBTMC_device.ask";
static const char __pyx_k_WAV_POINTS_100000[] = ":WAV:POINTS 100000;\n";
static const char __pyx_k_dispose_resources[] = "dispose_resources";
static const char __pyx_k_indicator_pulse_2[] = "indicator pulse,";
static const char __pyx_k_set_configuration[] = "set_configuration";
static const char __pyx_k_term_char_enabled[] = "term_char_enabled";
static const char __pyx_k_termchar_enable_2[] = "termchar enable";
static const char __pyx_k_CHECK_CLEAR_STATUS[] = "CHECK_CLEAR_STATUS";
static const char __pyx_k_CTRL_TYPE_RESERVED[] = "CTRL_TYPE_RESERVED";
static const char __pyx_k_CTRL_TYPE_STANDARD[] = "CTRL_TYPE_STANDARD";
static const char __pyx_k_DESC_TYPE_ENDPOINT[] = "DESC_TYPE_ENDPOINT";
static const char __pyx_k_ENDPOINT_TYPE_BULK[] = "ENDPOINT_TYPE_BULK";
static const char __pyx_k_ENDPOINT_TYPE_CTRL[] = "ENDPOINT_TYPE_CTRL";
static const char __pyx_k_ENDPOINT_TYPE_INTR[] = "ENDPOINT_TYPE_INTR";
static const char __pyx_k_ENDPOINT_TYPE_MASK[] = "ENDPOINT_TYPE_MASK";
static const char __pyx_k_USBTMC_BulkInError[] = "USBTMC_BulkInError";
static const char __pyx_k_USBTMC_device_ask0[] = "USBTMC_device.ask0";
static const char __pyx_k_USBTMC_device_read[] = "USBTMC_device.read";
static const char __pyx_k_VENDOR_SPECIFIC_IN[] = "VENDOR_SPECIFIC_IN";
static const char __pyx_k_bInterfaceProtocol[] = "bInterfaceProtocol";
static const char __pyx_k_bInterfaceSubClass[] = "bInterfaceSubClass";
static const char __pyx_k_build_request_type[] = "build_request_type";
static const char __pyx_k_check_clear_status[] = "check_clear_status";
static const char __pyx_k_clear_bulk_in_halt[] = "clear_bulk_in_halt";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_s_1c_1c_1c_1c_1c_2[] = "%s%1c%1c%1c%1c\000%1c\000\000";
static const char __pyx_k_size_of_waveform_s[] = "size of waveform %s \n";
static const char __pyx_k_DESC_TYPE_INTERFACE[] = "DESC_TYPE_INTERFACE";
static const char __pyx_k_SelectedDeviceClear[] = "SelectedDeviceClear";
static const char __pyx_k_USBTMC_Capabilities[] = "USBTMC_Capabilities";
static const char __pyx_k_USBTMC_SIZE_DEFAULT[] = "USBTMC_SIZE_DEFAULT";
static const char __pyx_k_USBTMC_device___del[] = "USBTMC_device.__del__";
static const char __pyx_k_USBTMC_device_clear[] = "USBTMC_device.clear";
static const char __pyx_k_USBTMC_device_read0[] = "USBTMC_device.read0";
static const char __pyx_k_USBTMC_device_reset[] = "USBTMC_device.reset";
static const char __pyx_k_USBTMC_device_write[] = "USBTMC_device.write";
static const char __pyx_k_VENDOR_SPECIFIC_OUT[] = "VENDOR_SPECIFIC_OUT";
static const char __pyx_k_VOLTAGE_OFFSET_1_00[] = "VOLTAGE:OFFSET 1.00\n";
static const char __pyx_k_VendorSpec_Responce[] = "VendorSpec_Responce";
static const char __pyx_k_clear_bulk_out_halt[] = "clear_bulk_out_halt";
static const char __pyx_k_device_capabilities[] = "device_capabilities";
static const char __pyx_k_Abort_bulk_out_Error[] = "Abort_bulk_out Error";
static const char __pyx_k_BulkIn_Header___init[] = "BulkIn_Header.__init__";
static const char __pyx_k_CTRL_RECIPIENT_OTHER[] = "CTRL_RECIPIENT_OTHER";
static const char __pyx_k_DEVICE_REMOTE_WAKEUP[] = "DEVICE_REMOTE_WAKEUP";
static const char __pyx_k_SOURCE2_FUNCTION_SIN[] = "SOURCE2:FUNCTION SIN\n";
static const char __pyx_k_USB488_Status___init[] = "USB488_Status.__init__";
static const char __pyx_k_USBTMC_SIZE_IOBUFFER[] = "USBTMC_SIZE_IOBUFFER";
static const char __pyx_k_USBTMC_device___init[] = "USBTMC_device.__init__";
static const char __pyx_k_detach_kernel_driver[] = "detach_kernel_driver";
static const char __pyx_k_mkDevDepMSGOUTHeader[] = "mkDevDepMSGOUTHeader";
static const char __pyx_k_CTRL_RECIPIENT_DEVICE[] = "CTRL_RECIPIENT_DEVICE";
static const char __pyx_k_SPLIT_NOT_IN_PROGRESS[] = "SPLIT_NOT_IN_PROGRESS";
static const char __pyx_k_Split_not_in_progress[] = "Split not in progress";
static const char __pyx_k_USB488_device_TRIGGER[] = "USB488_device.TRIGGER";
static const char __pyx_k_Waveform_from_DPO30xx[] = "Waveform from DPO30xx";
static const char __pyx_k_DevDep_Responce___init[] = "DevDep_Responce.__init__";
static const char __pyx_k_INITIATE_ABORT_BULK_IN[] = "INITIATE_ABORT_BULK_IN";
static const char __pyx_k_REQUEST_DEV_DEP_MSG_IN[] = "REQUEST_DEV_DEP_MSG_IN";
static const char __pyx_k_SOURCE2_FREQUENCY_10E3[] = "SOURCE2:FREQUENCY 10E3\n";
static const char __pyx_k_USBTMC_DEFAULT_TIMEOUT[] = "USBTMC_DEFAULT_TIMEOUT";
static const char __pyx_k_USBTMC_bInterfaceClass[] = "USBTMC_bInterfaceClass";
static const char __pyx_k_USBTMC_device_find_all[] = "USBTMC_device.find_all";
static const char __pyx_k_USBTMC_device_isUSB488[] = "USBTMC_device.isUSB488";
static const char __pyx_k_VOLTAGE_AMPLITUDE_2_00[] = "VOLTAGE:AMPLITUDE 2.00\n";
static const char __pyx_k_Waveform_from_DPO4034B[] = "Waveform from DPO4034B";
static const char __pyx_k_interface_capabilities[] = "interface_capabilities";
static const char __pyx_k_mkReqDevDepMSGINHeader[] = "mkReqDevDepMSGINHeader";
static const char __pyx_k_CTRL_RECIPIENT_ENDPOINT[] = "CTRL_RECIPIENT_ENDPOINT";
static const char __pyx_k_ENDPOINT_TYPE_INTERRUPT[] = "ENDPOINT_TYPE_INTERRUPT";
static const char __pyx_k_IEEE488_Status_Byte_Reg[] = "IEEE488_Status_Byte_Reg";
static const char __pyx_k_INITIATE_ABORT_BULK_OUT[] = "INITIATE_ABORT_BULK_OUT";
static const char __pyx_k_USB488_device_GoToLocal[] = "USB488_device.GoToLocal";
static const char __pyx_k_USBTMC_device_check_SRQ[] = "USBTMC_device.check_SRQ";
static const char __pyx_k_is_kernel_driver_active[] = "is_kernel_driver_active";
static const char __pyx_k_usbtmc_attribute___init[] = "usbtmc_attribute.__init__";
static const char __pyx_k_usbtmc_dev_capabilities[] = "usbtmc_dev_capabilities";
static const char __pyx_k_CTRL_RECIPIENT_INTERFACE[] = "CTRL_RECIPIENT_INTERFACE";
static const char __pyx_k_Interrupt_IN_Data___init[] = "Interrupt_IN_Data.__init__";
static const char __pyx_k_TRANSFER_NOT_IN_PROGRESS[] = "TRANSFER_NOT_IN_PROGRESS";
static const char __pyx_k_Transfer_not_in_progress[] = "Transfer not in progress";
static const char __pyx_k_USBTMC_device_clear_halt[] = "USBTMC_device.clear_halt";
static const char __pyx_k_mkVendorSpecMSGOUTHeader[] = "mkVendorSpecMSGOUTHeader";
static const char __pyx_k_set_interface_altsetting[] = "set_interface_altsetting";
static const char __pyx_k_USB488_bInterfaceSubClass[] = "USB488_bInterfaceSubClass";
static const char __pyx_k_USBTMC_Capabilities___str[] = "USBTMC_Capabilities.__str__";
static const char __pyx_k_USBTMC_bInterfaceProtocol[] = "USBTMC_bInterfaceProtocol";
static const char __pyx_k_USBTMC_bInterfaceSubClass[] = "USBTMC_bInterfaceSubClass";
static const char __pyx_k_USBTMC_device___init_data[] = "USBTMC_device.__init_data__";
static const char __pyx_k_USBTMC_device_device_read[] = "USBTMC_device.device_read";
static const char __pyx_k_USBTMC_device_vender_read[] = "USBTMC_device.vender_read";
static const char __pyx_k_CHECK_ABORT_BULK_IN_STATUS[] = "CHECK_ABORT_BULK_IN_STATUS";
static const char __pyx_k_REQUEST_VENDOR_SPECIFIC_IN[] = "REQUEST_VENDOR_SPECIFIC_IN";
static const char __pyx_k_SOURCE2_PHASE_ADJUST_90DEG[] = "SOURCE2:PHASE:ADJUST 90DEG\n";
static const char __pyx_k_USB488_device_LocalLockOut[] = "USB488_device.LocalLockOut";
static const char __pyx_k_USB488_device_RemoteEnable[] = "USB488_device.RemoteEnable";
static const char __pyx_k_USBTMC_Capabilities___init[] = "USBTMC_Capabilities.__init__";
static const char __pyx_k_USBTMC_device_device_write[] = "USBTMC_device.device_write";
static const char __pyx_k_USBTMC_device_getendpoints[] = "USBTMC_device.getendpoints";
static const char __pyx_k_USBTMC_device_vender_write[] = "USBTMC_device.vender_write";
static const char __pyx_k_VendorSpec_Responce___init[] = "VendorSpec_Responce.__init__";
static const char __pyx_k_check_abort_bulk_in_status[] = "check_abort_bulk_in_status";
static const char __pyx_k_mkReqVendorSpecMSGINHeader[] = "mkReqVendorSpecMSGINHeader";
static const char __pyx_k_usb488_device_capabilities[] = "usb488_device_capabilities";
static const char __pyx_k_CHECK_ABORT_BULK_OUT_STATUS[] = "CHECK_ABORT_BULK_OUT_STATUS";
static const char __pyx_k_SOURCE2_VOLTAGE_OFFSET_0_00[] = "SOURCE2:VOLTAGE:OFFSET 0.00\n";
static const char __pyx_k_USBTMC_device_abort_bulk_in[] = "USBTMC_device.abort_bulk_in";
static const char __pyx_k_check_abort_bulk_int_status[] = "check_abort_bulk_int_status";
static const char __pyx_k_check_abort_bulk_out_status[] = "check_abort_bulk_out_status";
static const char __pyx_k_USBTMC_device_abort_bulk_out[] = "USBTMC_device.abort_bulk_out";
static const char __pyx_k_USBTMC_device_usb_get_status[] = "USBTMC_device.usb_get_status";
static const char __pyx_k_USBTMC_device_indicator_pulse[] = "USBTMC_device.indicator_pulse";
static const char __pyx_k_Waveform_from_Yokogawa_SL1000[] = "Waveform from Yokogawa SL1000";
static const char __pyx_k_usb488_interface_capabilities[] = "usb488_interface_capabilities";
static const char __pyx_k_IEEE488_Status_Byte_Reg___init[] = "IEEE488_Status_Byte_Reg.__init__";
static const char __pyx_k_Initiate_abort_bulk_out_failed[] = "Initiate abort_bulk_out failed";
static const char __pyx_k_SOURCE2_VOLTAGE_AMPLITUDE_1_00[] = "SOURCE2:VOLTAGE:AMPLITUDE 1.00\n";
static const char __pyx_k_USB488_device_Read_Status_Byte[] = "USB488_device.Read_Status_Byte";
static const char __pyx_k_USBTMC_device_get_capabilities[] = "USBTMC_device.get_capabilities";
static const char __pyx_k_convert_return_value_header_to[] = "\n    convert return value header to structure\n    ";
static const char __pyx_k_usbtmc_dev_capabilities___init[] = "usbtmc_dev_capabilities.__init__";
static const char __pyx_k_Initiate_abort_bulk_in_failed_d[] = "Initiate abort_bulk_in failed %d";
static const char __pyx_k_PyUSBTMC_python_module_to_handl[] = "\nPyUSBTMC:python module to handle USB-TMC(Test and Measurement class)\343\200\200devices.\nIt requires pyusb module and libusb or openusb libraries.\n(C) 2012-2015, Noboru Yamamot, Accl. Lab, KEK, JAPAN\ncontact: noboru.yamamoto_at_kek.jp\n";
static const char __pyx_k_STOP_SINGLE_WAV_POINTS_MODE_MAX[] = ":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;";
static const char __pyx_k_USB488_device_GetExecuteTrigger[] = "USB488_device.GetExecuteTrigger";
static const char __pyx_k_USBTMC_usb_control_msg_returned[] = "USBTMC: usb_control_msg returned None\n";
static const char __pyx_k_the_device_is_not_USBTMC_USB488[] = "the device is not USBTMC/USB488 Class device";
static const char __pyx_k_Couldn_t_clear_device_buffer_wit[] = "Couldn't clear device buffer within %d cycles\n";
static const char __pyx_k_EMEM_data_from_Tektronix_AFG3000[] = "EMEM data from Tektronix AFG3000 series";
static const char __pyx_k_INDICATOR_PULSE_is_not_supported[] = "INDICATOR_PULSE is not supported on this device";
static const char __pyx_k_Python_USBTMC_module_example_fro[] = "Python USBTMC module example from %s";
static const char __pyx_k_Python_USBTMC_module_example_n_f[] = "Python USBTMC module example \\n from %s";
static const char __pyx_k_TMC_device_must_have_both_Bulk_I[] = "TMC device must have both Bulk-In and Bulk-out endpoints.";
static const char __pyx_k_USB488_device_SelectedDeviceClea[] = "USB488_device.SelectedDeviceClear";
static const char __pyx_k_USBTMC_MAX_READS_TO_CLEAR_BULK_I[] = "USBTMC_MAX_READS_TO_CLEAR_BULK_IN";
static const char __pyx_k_USBTMC_device_check_abort_bulk_i[] = "USBTMC_device.check_abort_bulk_in_status";
static const char __pyx_k_USBTMC_device_check_abort_bulk_o[] = "USBTMC_device.check_abort_bulk_out_status";
static const char __pyx_k_USBTMC_device_check_clear_status[] = "USBTMC_device.check_clear_status";
static const char __pyx_k_USBTMC_device_clear_bulk_in_halt[] = "USBTMC_device.clear_bulk_in_halt";
static const char __pyx_k_USBTMC_device_clear_bulk_out_hal[] = "USBTMC_device.clear_bulk_out_halt";
static const char __pyx_k_USBTMC_should_have_at_least_2_en[] = "USBTMC should have at least 2  endpoints but not %d";
static const char __pyx_k_clear_status_failed_too_many_ite[] = "clear status failed: too many iteration";
static const char __pyx_k_find_tmc_devices_locals_is_usbtm[] = "find_tmc_devices.<locals>.is_usbtmc";
static const char __pyx_k_read_d_bytes_in_f_seconds_f_byte[] = "read %d bytes in %f seconds %f bytes/second";
static PyObject *__pyx_kp_s_0x_2x_2x;
static PyObject *__pyx_kp_s_1c_1c_1c;
static PyObject *__pyx_kp_s_ACQ;
static PyObject *__pyx_n_s_AFG3K_setup_test;
static PyObject *__pyx_n_s_AFG3K_test;
static PyObject *__pyx_kp_s_ALARM;
static PyObject *__pyx_kp_s_Abort_bulk_out_Error;
static PyObject *__pyx_n_s_B;
static PyObject *__pyx_n_s_BulkIn_Header;
static PyObject *__pyx_n_s_BulkIn_Header___init;
static PyObject *__pyx_kp_s_CAL;
static PyObject *__pyx_n_s_CAL_2;
static PyObject *__pyx_kp_s_CHAN1;
static PyObject *__pyx_n_s_CHECK_ABORT_BULK_IN_STATUS;
static PyObject *__pyx_n_s_CHECK_ABORT_BULK_OUT_STATUS;
static PyObject *__pyx_n_s_CHECK_CLEAR_STATUS;
static PyObject *__pyx_kp_s_CLS;
static PyObject *__pyx_n_s_CLS_2;
static PyObject *__pyx_kp_s_CONTROL;
static PyObject *__pyx_n_s_CTRL_IN;
static PyObject *__pyx_n_s_CTRL_OUT;
static PyObject *__pyx_n_s_CTRL_RECIPIENT_DEVICE;
static PyObject *__pyx_n_s_CTRL_RECIPIENT_ENDPOINT;
static PyObject *__pyx_n_s_CTRL_RECIPIENT_INTERFACE;
static PyObject *__pyx_n_s_CTRL_RECIPIENT_OTHER;
static PyObject *__pyx_n_s_CTRL_TYPE_CLASS;
static PyObject *__pyx_n_s_CTRL_TYPE_RESERVED;
static PyObject *__pyx_n_s_CTRL_TYPE_STANDARD;
static PyObject *__pyx_n_s_CTRL_TYPE_VENDOR;
static PyObject *__pyx_kp_s_CURVE;
static PyObject *__pyx_kp_s_Couldn_t_clear_device_buffer_wit;
static PyObject *__pyx_kp_s_DATA;
static PyObject *__pyx_kp_s_DATA_DATA_EMEM;
static PyObject *__pyx_kp_s_DATE;
static PyObject *__pyx_kp_s_DAT_ENC_ASCI;
static PyObject *__pyx_kp_s_DAT_ENC_SRP;
static PyObject *__pyx_kp_s_DAT_SOU_CH1;
static PyObject *__pyx_kp_s_DCL;
static PyObject *__pyx_n_s_DCL_2;
static PyObject *__pyx_kp_s_DDT;
static PyObject *__pyx_kp_s_DDT_2;
static PyObject *__pyx_n_s_DDT_3;
static PyObject *__pyx_n_s_DESC_TYPE_CONFIG;
static PyObject *__pyx_n_s_DESC_TYPE_DEVICE;
static PyObject *__pyx_n_s_DESC_TYPE_ENDPOINT;
static PyObject *__pyx_n_s_DESC_TYPE_INTERFACE;
static PyObject *__pyx_n_s_DESC_TYPE_STRING;
static PyObject *__pyx_n_s_DEVICE_REMOTE_WAKEUP;
static PyObject *__pyx_n_s_DEV_DEP_MSG_IN;
static PyObject *__pyx_n_s_DEV_DEP_MSG_OUT;
static PyObject *__pyx_kp_s_DMC;
static PyObject *__pyx_n_s_DMC_2;
static PyObject *__pyx_n_s_DPO3K_test;
static PyObject *__pyx_n_s_DPO4K_test;
static PyObject *__pyx_n_s_DSO6K_test;
static PyObject *__pyx_n_s_DSO6K_test_pylab;
static PyObject *__pyx_n_s_DT1;
static PyObject *__pyx_n_s_DevDep_Responce;
static PyObject *__pyx_n_s_DevDep_Responce___init;
static PyObject *__pyx_n_s_Device;
static PyObject *__pyx_n_s_Done;
static PyObject *__pyx_kp_s_EMC;
static PyObject *__pyx_kp_s_EMC_2;
static PyObject *__pyx_n_s_EMC_3;
static PyObject *__pyx_kp_s_EMEM_data_from_Tektronix_AFG3000;
static PyObject *__pyx_n_s_ENDPOINT_DIR_MASK;
static PyObject *__pyx_n_s_ENDPOINT_HALT;
static PyObject *__pyx_n_s_ENDPOINT_IN;
static PyObject *__pyx_n_s_ENDPOINT_OUT;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_BULK;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_CTRL;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_INTERRUPT;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_INTR;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_ISO;
static PyObject *__pyx_n_s_ENDPOINT_TYPE_MASK;
static PyObject *__pyx_n_s_ESB;
static PyObject *__pyx_kp_s_ESE;
static PyObject *__pyx_kp_s_ESE_2;
static PyObject *__pyx_n_s_ESE_3;
static PyObject *__pyx_kp_s_ESQ;
static PyObject *__pyx_n_s_ESR;
static PyObject *__pyx_n_s_FAILED;
static PyObject *__pyx_kp_s_FREQUENCY_10E3;
static PyObject *__pyx_kp_s_FUNCTION_SIN;
static PyObject *__pyx_n_s_Failed;
static PyObject *__pyx_n_s_GET_CAPABILITIES;
static PyObject *__pyx_kp_s_GMC;
static PyObject *__pyx_n_s_GMC_2;
static PyObject *__pyx_n_s_GOTO_LOCAL;
static PyObject *__pyx_n_s_GetExecuteTrigger;
static PyObject *__pyx_n_s_Gnuplot;
static PyObject *__pyx_n_s_GoToLocal;
static PyObject *__pyx_kp_s_IDN;
static PyObject *__pyx_kp_s_IDN_2;
static PyObject *__pyx_kp_s_IDN_3;
static PyObject *__pyx_n_s_IDN_4;
static PyObject *__pyx_n_s_IEEE488_Status_Byte_Reg;
static PyObject *__pyx_n_s_IEEE488_Status_Byte_Reg___init;
static PyObject *__pyx_n_s_INDICATOR_PULSE;
static PyObject *__pyx_kp_s_INDICATOR_PULSE_is_not_supported;
static PyObject *__pyx_n_s_INITIATE_ABORT_BULK_IN;
static PyObject *__pyx_n_s_INITIATE_ABORT_BULK_OUT;
static PyObject *__pyx_n_s_INITIATE_CLEAR;
static PyObject *__pyx_n_s_INTERRUPT_IN_BUSY;
static PyObject *__pyx_kp_s_Initiate_abort_bulk_in_failed_d;
static PyObject *__pyx_kp_s_Initiate_abort_bulk_out_failed;
static PyObject *__pyx_n_s_Interrupt_IN_Data;
static PyObject *__pyx_n_s_Interrupt_IN_Data___init;
static PyObject *__pyx_kp_s_Interrupt_in_busy;
static PyObject *__pyx_kp_s_LMC;
static PyObject *__pyx_n_s_LMC_2;
static PyObject *__pyx_n_s_LOCAL_LOCKOUT;
static PyObject *__pyx_kp_s_LRN;
static PyObject *__pyx_n_s_LRN_2;
static PyObject *__pyx_n_s_LocalLockOut;
static PyObject *__pyx_n_s_MAV;
static PyObject *__pyx_kp_s_MEAS;
static PyObject *__pyx_n_s_MSG;
static PyObject *__pyx_n_s_Mandatory_LANGID;
static PyObject *__pyx_kp_s_Not_Implemented;
static PyObject *__pyx_kp_s_OPC;
static PyObject *__pyx_kp_s_OPC_2;
static PyObject *__pyx_n_s_OPC_3;
static PyObject *__pyx_n_s_OPER;
static PyObject *__pyx_kp_s_OPT;
static PyObject *__pyx_n_s_OPT_2;
static PyObject *__pyx_n_s_PENDING;
static PyObject *__pyx_kp_s_PHASE_ADJUST_0DEG;
static PyObject *__pyx_kp_s_PSC;
static PyObject *__pyx_kp_s_PSC_2;
static PyObject *__pyx_n_s_PSC_3;
static PyObject *__pyx_kp_s_PUD;
static PyObject *__pyx_n_s_PUD_2;
static PyObject *__pyx_n_s_Pending;
static PyObject *__pyx_kp_s_Python_USBTMC_module_example_fro;
static PyObject *__pyx_kp_s_Python_USBTMC_module_example_n_f;
static PyObject *__pyx_kp_s_RCL;
static PyObject *__pyx_n_s_RCL_2;
static PyObject *__pyx_kp_s_RDT;
static PyObject *__pyx_kp_s_RDT_2;
static PyObject *__pyx_n_s_RDT_3;
static PyObject *__pyx_n_s_READ_STATUS_BYTE;
static PyObject *__pyx_n_s_REN_CONTROL;
static PyObject *__pyx_n_s_REQUEST_DEV_DEP_MSG_IN;
static PyObject *__pyx_n_s_REQUEST_VENDOR_SPECIFIC_IN;
static PyObject *__pyx_n_s_REQ_CLEAR_FEATURE;
static PyObject *__pyx_n_s_RL1;
static PyObject *__pyx_kp_s_RMC;
static PyObject *__pyx_n_s_RMC_2;
static PyObject *__pyx_n_s_RQS_MSS;
static PyObject *__pyx_kp_s_RST;
static PyObject *__pyx_kp_s_RST_2;
static PyObject *__pyx_n_s_RST_3;
static PyObject *__pyx_n_s_Read_Status_Byte;
static PyObject *__pyx_n_s_RemoteEnable;
static PyObject *__pyx_n_s_Reserved;
static PyObject *__pyx_n_s_SAD;
static PyObject *__pyx_kp_s_SAV;
static PyObject *__pyx_n_s_SAV_2;
static PyObject *__pyx_n_s_SBR;
static PyObject *__pyx_n_s_SCPI;
static PyObject *__pyx_kp_s_SDS;
static PyObject *__pyx_n_s_SDS_2;
static PyObject *__pyx_n_s_SL1K_test;
static PyObject *__pyx_kp_s_SOURCE2_FREQUENCY_10E3;
static PyObject *__pyx_kp_s_SOURCE2_FUNCTION_SIN;
static PyObject *__pyx_kp_s_SOURCE2_PHASE_ADJUST_90DEG;
static PyObject *__pyx_kp_s_SOURCE2_VOLTAGE_AMPLITUDE_1_00;
static PyObject *__pyx_kp_s_SOURCE2_VOLTAGE_OFFSET_0_00;
static PyObject *__pyx_n_s_SPLIT_IN_PROGRESS;
static PyObject *__pyx_n_s_SPLIT_NOT_IN_PROGRESS;
static PyObject *__pyx_n_s_SR1;
static PyObject *__pyx_kp_s_SRE;
static PyObject *__pyx_n_s_SRE_2;
static PyObject *__pyx_kp_s_SRE_d;
static PyObject *__pyx_n_s_SREmask;
static PyObject *__pyx_kp_s_STB;
static PyObject *__pyx_n_s_STB_2;
static PyObject *__pyx_kp_s_STOP;
static PyObject *__pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX;
static PyObject *__pyx_n_s_SUCCESS;
static PyObject *__pyx_n_s_SelectedDeviceClear;
static PyObject *__pyx_kp_s_Split_in_progress;
static PyObject *__pyx_kp_s_Split_not_in_progress;
static PyObject *__pyx_n_s_StandardFeature;
static PyObject *__pyx_n_s_Success;
static PyObject *__pyx_kp_s_TER;
static PyObject *__pyx_n_s_TER_2;
static PyObject *__pyx_n_s_TEST_MODE;
static PyObject *__pyx_kp_s_TMC_device_must_have_both_Bulk_I;
static PyObject *__pyx_n_s_TRANSFER_NOT_IN_PROGRESS;
static PyObject *__pyx_n_s_TRG;
static PyObject *__pyx_kp_s_TRG_2;
static PyObject *__pyx_kp_s_TRIG;
static PyObject *__pyx_n_s_TRIGGER;
static PyObject *__pyx_kp_s_TST;
static PyObject *__pyx_n_s_TST_2;
static PyObject *__pyx_n_s_TermChar;
static PyObject *__pyx_n_s_TermCharEnable;
static PyObject *__pyx_n_s_TransferSize;
static PyObject *__pyx_kp_s_Transfer_not_in_progress;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_USB488;
static PyObject *__pyx_n_s_USB488_REQUEST;
static PyObject *__pyx_n_s_USB488_Status;
static PyObject *__pyx_n_s_USB488_Status___init;
static PyObject *__pyx_n_s_USB488_Status_msg;
static PyObject *__pyx_n_s_USB488_bInterfaceSubClass;
static PyObject *__pyx_n_s_USB488_device;
static PyObject *__pyx_n_s_USB488_device_CAL;
static PyObject *__pyx_n_s_USB488_device_CLS;
static PyObject *__pyx_n_s_USB488_device_DCL;
static PyObject *__pyx_n_s_USB488_device_DDT;
static PyObject *__pyx_n_s_USB488_device_DMC;
static PyObject *__pyx_n_s_USB488_device_EMC;
static PyObject *__pyx_n_s_USB488_device_ESE;
static PyObject *__pyx_n_s_USB488_device_ESR;
static PyObject *__pyx_n_s_USB488_device_GMC;
static PyObject *__pyx_n_s_USB488_device_GetExecuteTrigger;
static PyObject *__pyx_n_s_USB488_device_GoToLocal;
static PyObject *__pyx_n_s_USB488_device_IDN;
static PyObject *__pyx_n_s_USB488_device_LMC;
static PyObject *__pyx_n_s_USB488_device_LRN;
static PyObject *__pyx_n_s_USB488_device_LocalLockOut;
static PyObject *__pyx_n_s_USB488_device_OPC;
static PyObject *__pyx_n_s_USB488_device_OPT;
static PyObject *__pyx_n_s_USB488_device_PSC;
static PyObject *__pyx_n_s_USB488_device_PUD;
static PyObject *__pyx_n_s_USB488_device_RCL;
static PyObject *__pyx_n_s_USB488_device_RDT;
static PyObject *__pyx_n_s_USB488_device_RMC;
static PyObject *__pyx_n_s_USB488_device_RST;
static PyObject *__pyx_n_s_USB488_device_Read_Status_Byte;
static PyObject *__pyx_n_s_USB488_device_RemoteEnable;
static PyObject *__pyx_n_s_USB488_device_SAD;
static PyObject *__pyx_n_s_USB488_device_SAV;
static PyObject *__pyx_n_s_USB488_device_SDS;
static PyObject *__pyx_n_s_USB488_device_SRE;
static PyObject *__pyx_n_s_USB488_device_STB;
static PyObject *__pyx_n_s_USB488_device_SelectedDeviceClea;
static PyObject *__pyx_n_s_USB488_device_TER;
static PyObject *__pyx_n_s_USB488_device_TRG;
static PyObject *__pyx_n_s_USB488_device_TRIGGER;
static PyObject *__pyx_n_s_USB488_device_TST;
static PyObject *__pyx_n_s_USB488_device_WAI;
static PyObject *__pyx_n_s_USBError;
static PyObject *__pyx_n_s_USBTMCError;
static PyObject *__pyx_n_s_USBTMC_BulkInError;
static PyObject *__pyx_n_s_USBTMC_Capabilities;
static PyObject *__pyx_n_s_USBTMC_Capabilities___init;
static PyObject *__pyx_n_s_USBTMC_Capabilities___str;
static PyObject *__pyx_n_s_USBTMC_DEFAULT_TIMEOUT;
static PyObject *__pyx_n_s_USBTMC_MAX_READS_TO_CLEAR_BULK_I;
static PyObject *__pyx_n_s_USBTMC_MsgID;
static PyObject *__pyx_n_s_USBTMC_REQUEST;
static PyObject *__pyx_n_s_USBTMC_SIZE_DEFAULT;
static PyObject *__pyx_n_s_USBTMC_SIZE_IOBUFFER;
static PyObject *__pyx_n_s_USBTMC_Status;
static PyObject *__pyx_n_s_USBTMC_Status_msg;
static PyObject *__pyx_n_s_USBTMC_bInterfaceClass;
static PyObject *__pyx_n_s_USBTMC_bInterfaceProtocol;
static PyObject *__pyx_n_s_USBTMC_bInterfaceSubClass;
static PyObject *__pyx_n_s_USBTMC_device;
static PyObject *__pyx_n_s_USBTMC_device___del;
static PyObject *__pyx_n_s_USBTMC_device___init;
static PyObject *__pyx_n_s_USBTMC_device___init_data;
static PyObject *__pyx_n_s_USBTMC_device_abort_bulk_in;
static PyObject *__pyx_n_s_USBTMC_device_abort_bulk_out;
static PyObject *__pyx_n_s_USBTMC_device_ask;
static PyObject *__pyx_n_s_USBTMC_device_ask0;
static PyObject *__pyx_n_s_USBTMC_device_check_SRQ;
static PyObject *__pyx_n_s_USBTMC_device_check_abort_bulk_i;
static PyObject *__pyx_n_s_USBTMC_device_check_abort_bulk_o;
static PyObject *__pyx_n_s_USBTMC_device_check_clear_status;
static PyObject *__pyx_n_s_USBTMC_device_clear;
static PyObject *__pyx_n_s_USBTMC_device_clear_bulk_in_halt;
static PyObject *__pyx_n_s_USBTMC_device_clear_bulk_out_hal;
static PyObject *__pyx_n_s_USBTMC_device_clear_halt;
static PyObject *__pyx_n_s_USBTMC_device_device_read;
static PyObject *__pyx_n_s_USBTMC_device_device_write;
static PyObject *__pyx_n_s_USBTMC_device_find_all;
static PyObject *__pyx_n_s_USBTMC_device_get_capabilities;
static PyObject *__pyx_n_s_USBTMC_device_getendpoints;
static PyObject *__pyx_n_s_USBTMC_device_indicator_pulse;
static PyObject *__pyx_n_s_USBTMC_device_isUSB488;
static PyObject *__pyx_n_s_USBTMC_device_read;
static PyObject *__pyx_n_s_USBTMC_device_read0;
static PyObject *__pyx_n_s_USBTMC_device_reset;
static PyObject *__pyx_n_s_USBTMC_device_usb_get_status;
static PyObject *__pyx_n_s_USBTMC_device_vender_read;
static PyObject *__pyx_n_s_USBTMC_device_vender_write;
static PyObject *__pyx_n_s_USBTMC_device_write;
static PyObject *__pyx_kp_s_USBTMC_should_have_at_least_2_en;
static PyObject *__pyx_n_s_USBTMC_status;
static PyObject *__pyx_kp_s_USBTMC_usb_control_msg_returned;
static PyObject *__pyx_n_s_USR;
static PyObject *__pyx_n_s_VENDOR_SPECIFIC_IN;
static PyObject *__pyx_n_s_VENDOR_SPECIFIC_OUT;
static PyObject *__pyx_kp_s_VOLTAGE_AMPLITUDE_2_00;
static PyObject *__pyx_kp_s_VOLTAGE_OFFSET_1_00;
static PyObject *__pyx_n_s_VendorSpec_Responce;
static PyObject *__pyx_n_s_VendorSpec_Responce___init;
static PyObject *__pyx_kp_s_WAI;
static PyObject *__pyx_n_s_WAI_2;
static PyObject *__pyx_kp_s_WAV;
static PyObject *__pyx_kp_s_WAV_DATA;
static PyObject *__pyx_kp_s_WAV_FORMAT_BYTE;
static PyObject *__pyx_kp_s_WAV_LENGTH;
static PyObject *__pyx_kp_s_WAV_POINTS;
static PyObject *__pyx_kp_s_WAV_POINTS_100000;
static PyObject *__pyx_kp_s_WAV_POINT_s;
static PyObject *__pyx_kp_s_WAV_SEND;
static PyObject *__pyx_kp_s_WAV_SOURCE_CH1;
static PyObject *__pyx_kp_s_WAV_SOURCE_CH2;
static PyObject *__pyx_kp_s_WAV_TRACE_1;
static PyObject *__pyx_kp_s_WFMO_BYT_N_1;
static PyObject *__pyx_kp_s_Waveform_from_DPO30xx;
static PyObject *__pyx_kp_s_Waveform_from_DPO4034B;
static PyObject *__pyx_kp_s_Waveform_from_Yokogawa_SL1000;
static PyObject *__pyx_n_s__14;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_kp_s__4;
static PyObject *__pyx_kp_s__5;
static PyObject *__pyx_kp_s__9;
static PyObject *__pyx_n_s_abort_bulk_in;
static PyObject *__pyx_n_s_abort_bulk_out;
static PyObject *__pyx_n_s_aborting;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_ask;
static PyObject *__pyx_n_s_ask0;
static PyObject *__pyx_n_s_askS;
static PyObject *__pyx_n_s_attr;
static PyObject *__pyx_n_s_attribute;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_bEndpointAddress;
static PyObject *__pyx_n_s_bInterfaceClass;
static PyObject *__pyx_n_s_bInterfaceProtocol;
static PyObject *__pyx_n_s_bInterfaceSubClass;
static PyObject *__pyx_n_s_bInterval;
static PyObject *__pyx_n_s_bNumEndpoints;
static PyObject *__pyx_n_s_bRequest;
static PyObject *__pyx_n_s_bTag;
static PyObject *__pyx_n_s_bTagInverse;
static PyObject *__pyx_n_s_bTag__lastbtag;
static PyObject *__pyx_n_s_bTag_last;
static PyObject *__pyx_n_s_bTag_next;
static PyObject *__pyx_n_s_bcdUSB488;
static PyObject *__pyx_n_s_bcdUSBTMC;
static PyObject *__pyx_n_s_bmAttributes;
static PyObject *__pyx_n_s_bmRequestType;
static PyObject *__pyx_n_s_btag;
static PyObject *__pyx_n_s_buf;
static PyObject *__pyx_n_s_build_request_type;
static PyObject *__pyx_n_s_bulk_in;
static PyObject *__pyx_n_s_bulk_out;
static PyObject *__pyx_n_s_byte;
static PyObject *__pyx_n_s_bytes;
static PyObject *__pyx_n_s_cPyUSBTMC;
static PyObject *__pyx_kp_s_cPyUSBTMC_pyx;
static PyObject *__pyx_n_s_capabilities;
static PyObject *__pyx_n_s_cfg;
static PyObject *__pyx_n_s_check_SRQ;
static PyObject *__pyx_n_s_check_abort_bulk_in_status;
static PyObject *__pyx_n_s_check_abort_bulk_int_status;
static PyObject *__pyx_n_s_check_abort_bulk_out_status;
static PyObject *__pyx_n_s_check_clear_status;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_clear_bulk_in_halt;
static PyObject *__pyx_n_s_clear_bulk_out_halt;
static PyObject *__pyx_n_s_clear_halt;
static PyObject *__pyx_kp_s_clear_status_failed_too_many_ite;
static PyObject *__pyx_n_s_clf;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_cls;
static PyObject *__pyx_n_s_cmd;
static PyObject *__pyx_n_s_cnf;
static PyObject *__pyx_n_s_command;
static PyObject *__pyx_n_s_control;
static PyObject *__pyx_kp_s_convert_return_value_header_to;
static PyObject *__pyx_n_s_core;
static PyObject *__pyx_n_s_ctrl_transfer;
static PyObject *__pyx_n_s_custom_match;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_or_wLength;
static PyObject *__pyx_n_s_default_timeout;
static PyObject *__pyx_n_s_del;
static PyObject *__pyx_n_s_detach_kernel_driver;
static PyObject *__pyx_n_s_dev;
static PyObject *__pyx_n_s_device;
static PyObject *__pyx_n_s_device_capabilities;
static PyObject *__pyx_n_s_device_read;
static PyObject *__pyx_n_s_device_write;
static PyObject *__pyx_n_s_devs;
static PyObject *__pyx_n_s_direction;
static PyObject *__pyx_n_s_dispose_resoruce;
static PyObject *__pyx_n_s_dispose_resources;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_enable;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_eof;
static PyObject *__pyx_n_s_eom;
static PyObject *__pyx_n_s_ep;
static PyObject *__pyx_n_s_ep_type;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_find;
static PyObject *__pyx_n_s_find_all;
static PyObject *__pyx_n_s_find_descriptor;
static PyObject *__pyx_n_s_find_tmc_devices;
static PyObject *__pyx_n_s_find_tmc_devices_locals_is_usbtm;
static PyObject *__pyx_n_s_flag;
static PyObject *__pyx_n_s_get_capabilities;
static PyObject *__pyx_n_s_get_status;
static PyObject *__pyx_n_s_getendpoints;
static PyObject *__pyx_n_s_gp;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_hl;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_idVendor;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_indicator_pulse;
static PyObject *__pyx_kp_s_indicator_pulse_2;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_data;
static PyObject *__pyx_n_s_interface_capabilities;
static PyObject *__pyx_n_s_intf;
static PyObject *__pyx_n_s_intr_in;
static PyObject *__pyx_n_s_io_timeout;
static PyObject *__pyx_n_s_isUSB488;
static PyObject *__pyx_n_s_is_kernel_driver_active;
static PyObject *__pyx_n_s_is_usbtmc;
static PyObject *__pyx_n_s_last;
static PyObject *__pyx_n_s_last_read_bTag;
static PyObject *__pyx_n_s_last_write_bTag;
static PyObject *__pyx_n_s_listen_only;
static PyObject *__pyx_kp_s_listen_only_2;
static PyObject *__pyx_n_s_lock_timeout;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_maker;
static PyObject *__pyx_n_s_mask;
static PyObject *__pyx_n_s_max_size;
static PyObject *__pyx_n_s_maxsize;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_mkCommonHeader;
static PyObject *__pyx_n_s_mkDevDepMSGOUTHeader;
static PyObject *__pyx_n_s_mkReqDevDepMSGINHeader;
static PyObject *__pyx_n_s_mkReqVendorSpecMSGINHeader;
static PyObject *__pyx_n_s_mkTriggerHeader;
static PyObject *__pyx_n_s_mkVendorSpecMSGOUTHeader;
static PyObject *__pyx_n_s_model;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_msgID;
static PyObject *__pyx_n_s_msgid;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nd;
static PyObject *__pyx_n_s_ndata;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_num_endpoints;
static PyObject *__pyx_n_s_plot;
static PyObject *__pyx_n_s_points;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_pylab;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_raw;
static PyObject *__pyx_n_s_raw_resp;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_s_read0;
static PyObject *__pyx_n_s_readS;
static PyObject *__pyx_kp_s_read_d_bytes_in_f_seconds_f_byte;
static PyObject *__pyx_n_s_recipient;
static PyObject *__pyx_n_s_remaining;
static PyObject *__pyx_n_s_requestSize;
static PyObject *__pyx_n_s_res;
static PyObject *__pyx_n_s_resMsg;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_resp;
static PyObject *__pyx_n_s_retry_buf;
static PyObject *__pyx_n_s_rsize;
static PyObject *__pyx_n_s_rv;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_1c_1c_1c_1c;
static PyObject *__pyx_kp_s_s_1c_1c_1c_1c_1c;
static PyObject *__pyx_kp_s_s_1c_1c_1c_1c_1c_2;
static PyObject *__pyx_kp_s_s_1c_1c_1c_1c_2;
static PyObject *__pyx_n_s_s_2;
static PyObject *__pyx_kp_s_s_s;
static PyObject *__pyx_kp_s_s_s_s;
static PyObject *__pyx_n_s_sb;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_set_configuration;
static PyObject *__pyx_n_s_set_interface_altsetting;
static PyObject *__pyx_n_s_show;
static PyObject *__pyx_n_s_signal;
static PyObject *__pyx_kp_s_size_of_waveform_s;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_sn;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_statusBytes;
static PyObject *__pyx_n_s_stdout;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_talk_only;
static PyObject *__pyx_kp_s_talk_only_2;
static PyObject *__pyx_n_s_termChar;
static PyObject *__pyx_n_s_termCharFlag;
static PyObject *__pyx_n_s_term_char;
static PyObject *__pyx_n_s_term_char_enabled;
static PyObject *__pyx_n_s_termchar;
static PyObject *__pyx_n_s_termchar_enable;
static PyObject *__pyx_kp_s_termchar_enable_2;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_2;
static PyObject *__pyx_kp_s_the_device_is_not_USBTMC_USB488;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_timeout;
static PyObject *__pyx_n_s_title;
static PyObject *__pyx_n_s_tmcdev;
static PyObject *__pyx_n_s_tostring;
static PyObject *__pyx_n_s_transferSize;
static PyObject *__pyx_n_s_tsize;
static PyObject *__pyx_n_s_usb;
static PyObject *__pyx_n_s_usb488_device_capabilities;
static PyObject *__pyx_n_s_usb488_interface_capabilities;
static PyObject *__pyx_n_s_usb_control;
static PyObject *__pyx_n_s_usb_core;
static PyObject *__pyx_n_s_usb_get_status;
static PyObject *__pyx_n_s_usb_util;
static PyObject *__pyx_n_s_usbctrl;
static PyObject *__pyx_n_s_usbdev;
static PyObject *__pyx_n_s_usbdevs;
static PyObject *__pyx_n_s_usbtmc_attribute;
static PyObject *__pyx_n_s_usbtmc_attribute___init;
static PyObject *__pyx_n_s_usbtmc_dev_capabilities;
static PyObject *__pyx_n_s_usbtmc_dev_capabilities___init;
static PyObject *__pyx_n_s_util;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_vender_read;
static PyObject *__pyx_n_s_vender_write;
static PyObject *__pyx_n_s_vers;
static PyObject *__pyx_n_s_wIndex;
static PyObject *__pyx_n_s_wMaxPacketSize;
static PyObject *__pyx_n_s_wValue;
static PyObject *__pyx_n_s_wf;
static PyObject *__pyx_n_s_wf2;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_x0;
static PyObject *__pyx_n_s_xlabel;
static PyObject *__pyx_n_s_ylabel;
static PyObject *__pyx_pf_9cPyUSBTMC_16find_tmc_devices_is_usbtmc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_find_tmc_devices(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_23usbtmc_dev_capabilities___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_16usbtmc_attribute___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_Status_msg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_23IEEE488_Status_Byte_Reg___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_Status___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_Status_2msg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_find_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_2__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_device); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_4__init_data__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_8getendpoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_cnf, PyObject *__pyx_v_intf); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_10isUSB488(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_12usb_get_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_recipient); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_14reset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_16clear_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_18ask0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_termChar, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_io_timeout); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_20ask(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_termChar, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_io_timeout); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_22read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_io_timeout, CYTHON_UNUSED PyObject *__pyx_v_lock_timeout, PyObject *__pyx_v_flag, PyObject *__pyx_v_termChar); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_24read0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_io_timeout, CYTHON_UNUSED PyObject *__pyx_v_lock_timeout, PyObject *__pyx_v_flag, PyObject *__pyx_v_termChar); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_26write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_28device_write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_30device_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transferSize, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_termchar, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_32vender_write(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_34vender_read(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_maxsize); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_36check_SRQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_38abort_bulk_out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_40check_abort_bulk_out_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_42clear_bulk_out_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_44abort_bulk_in(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_46check_abort_bulk_in_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_48clear_bulk_in_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_50clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_52check_clear_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_54get_capabilities(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_56indicator_pulse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_CLS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_2ESE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_4ESR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_6IDN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_8OPC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_10RST(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_12SRE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_14STB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_16TRG(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_18TST(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_20WAI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_22CAL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_24DDT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_26DMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_28EMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_30GMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_32LMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_34LRN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_36PSC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_38PUD(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_40RCL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_42RDT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_44RMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_46SAV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_48SAD(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_50SDS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_52OPT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_54TER(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_56RemoteEnable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enable); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_58LocalLockOut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_60GoToLocal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_62Read_Status_Byte(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_64TRIGGER(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_66GetExecuteTrigger(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_68SelectedDeviceClear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_70DCL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_4bTag_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_4bTag_2last(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_2mkCommonHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_msgid); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_4mkTriggerHeader(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_6mkDevDepMSGOUTHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize, PyObject *__pyx_v_eom); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_8mkReqDevDepMSGINHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize, PyObject *__pyx_v_TermCharEnable, PyObject *__pyx_v_TermChar); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_10mkVendorSpecMSGOUTHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_12mkReqVendorSpecMSGINHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_13BulkIn_Header___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_15DevDep_Responce___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_19VendorSpec_Responce___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_17Interrupt_IN_Data___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_14test(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_16DSO6K_test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_18DSO6K_test_pylab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_20DPO4K_test(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_22DPO3K_test(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_24SL1K_test(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_26AFG3K_test(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cPyUSBTMC_28AFG3K_setup_test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev); /* proto */
static PyObject *__pyx_float_0_1;
static PyObject *__pyx_float_0_01;
static PyObject *__pyx_float_127_;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_12;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_24;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_64;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_126;
static PyObject *__pyx_int_127;
static PyObject *__pyx_int_128;
static PyObject *__pyx_int_129;
static PyObject *__pyx_int_130;
static PyObject *__pyx_int_131;
static PyObject *__pyx_int_160;
static PyObject *__pyx_int_161;
static PyObject *__pyx_int_162;
static PyObject *__pyx_int_254;
static PyObject *__pyx_int_255;
static PyObject *__pyx_int_1000;
static PyObject *__pyx_int_1033;
static PyObject *__pyx_int_1689;
static PyObject *__pyx_int_2391;
static PyObject *__pyx_int_3000;
static PyObject *__pyx_int_4096;
static PyObject *__pyx_int_65536;
static PyObject *__pyx_int_2000020;
static PyObject *__pyx_int_20000000;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__6;
static PyObject *__pyx_slice__7;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_slice__11;
static PyObject *__pyx_slice__12;
static PyObject *__pyx_slice__13;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__2;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__147;
static PyObject *__pyx_tuple__149;
static PyObject *__pyx_tuple__151;
static PyObject *__pyx_tuple__153;
static PyObject *__pyx_tuple__155;
static PyObject *__pyx_tuple__157;
static PyObject *__pyx_tuple__159;
static PyObject *__pyx_tuple__160;
static PyObject *__pyx_tuple__162;
static PyObject *__pyx_tuple__164;
static PyObject *__pyx_tuple__166;
static PyObject *__pyx_tuple__168;
static PyObject *__pyx_tuple__170;
static PyObject *__pyx_tuple__172;
static PyObject *__pyx_tuple__174;
static PyObject *__pyx_tuple__176;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__196;
static PyObject *__pyx_tuple__198;
static PyObject *__pyx_tuple__200;
static PyObject *__pyx_tuple__202;
static PyObject *__pyx_tuple__204;
static PyObject *__pyx_tuple__206;
static PyObject *__pyx_tuple__208;
static PyObject *__pyx_tuple__210;
static PyObject *__pyx_tuple__212;
static PyObject *__pyx_tuple__214;
static PyObject *__pyx_tuple__216;
static PyObject *__pyx_codeobj__16;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__22;
static PyObject *__pyx_codeobj__24;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__45;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__75;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__79;
static PyObject *__pyx_codeobj__81;
static PyObject *__pyx_codeobj__83;
static PyObject *__pyx_codeobj__85;
static PyObject *__pyx_codeobj__87;
static PyObject *__pyx_codeobj__89;
static PyObject *__pyx_codeobj__91;
static PyObject *__pyx_codeobj__93;
static PyObject *__pyx_codeobj__95;
static PyObject *__pyx_codeobj__97;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__104;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__112;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__120;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__127;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__136;
static PyObject *__pyx_codeobj__139;
static PyObject *__pyx_codeobj__141;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__146;
static PyObject *__pyx_codeobj__148;
static PyObject *__pyx_codeobj__150;
static PyObject *__pyx_codeobj__152;
static PyObject *__pyx_codeobj__154;
static PyObject *__pyx_codeobj__156;
static PyObject *__pyx_codeobj__158;
static PyObject *__pyx_codeobj__161;
static PyObject *__pyx_codeobj__163;
static PyObject *__pyx_codeobj__165;
static PyObject *__pyx_codeobj__167;
static PyObject *__pyx_codeobj__169;
static PyObject *__pyx_codeobj__171;
static PyObject *__pyx_codeobj__173;
static PyObject *__pyx_codeobj__175;
static PyObject *__pyx_codeobj__177;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__193;
static PyObject *__pyx_codeobj__195;
static PyObject *__pyx_codeobj__197;
static PyObject *__pyx_codeobj__199;
static PyObject *__pyx_codeobj__201;
static PyObject *__pyx_codeobj__203;
static PyObject *__pyx_codeobj__205;
static PyObject *__pyx_codeobj__207;
static PyObject *__pyx_codeobj__209;
static PyObject *__pyx_codeobj__211;
static PyObject *__pyx_codeobj__213;
static PyObject *__pyx_codeobj__215;
static PyObject *__pyx_codeobj__217;
/* Late includes */

/* "cPyUSBTMC.pyx":70
 * # it means 'use "<" in pack/unpack of struct module.'
 * 
 * def find_tmc_devices():             # <<<<<<<<<<<<<<
 *     """
 *     get the list of USB devices which belongs USBTMC Class.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_1find_tmc_devices(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9cPyUSBTMC_find_tmc_devices[] = "\n    get the list of USB devices which belongs USBTMC Class.\n    BaseInterface class/Sub class/Protcol=0xfe/0x03/(0x00 for TMC, 0x01 for USB488)\n    This function returns a list of usb device objects but not usbtmc object.\n    User must create USBTMC_device object or USB488_device object from the return \n    value from this function.  The user can use USBTMC_device.find_all() and USB488_device.find_all().\n    ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_1find_tmc_devices = {"find_tmc_devices", (PyCFunction)__pyx_pw_9cPyUSBTMC_1find_tmc_devices, METH_NOARGS, __pyx_doc_9cPyUSBTMC_find_tmc_devices};
static PyObject *__pyx_pw_9cPyUSBTMC_1find_tmc_devices(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_tmc_devices (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_find_tmc_devices(__pyx_self);

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

/* "cPyUSBTMC.pyx":78
 *     value from this function.  The user can use USBTMC_device.find_all() and USB488_device.find_all().
 *     """
 *     def is_usbtmc(d):             # <<<<<<<<<<<<<<
 *         for cfg in d:
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_16find_tmc_devices_1is_usbtmc(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_16find_tmc_devices_1is_usbtmc = {"is_usbtmc", (PyCFunction)__pyx_pw_9cPyUSBTMC_16find_tmc_devices_1is_usbtmc, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_16find_tmc_devices_1is_usbtmc(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_usbtmc (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_16find_tmc_devices_is_usbtmc(__pyx_self, ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_9cPyUSBTMC_16find_tmc_devices_is_usbtmc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_cfg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_usbtmc", 0);

  /* "cPyUSBTMC.pyx":79
 *     """
 *     def is_usbtmc(d):
 *         for cfg in d:             # <<<<<<<<<<<<<<
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 *             # strictry speaking, TMC or USB488 devices will be selected
 */
  if (likely(PyList_CheckExact(__pyx_v_d)) || PyTuple_CheckExact(__pyx_v_d)) {
    __pyx_t_1 = __pyx_v_d; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 79, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_cfg, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":82
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 *             # strictry speaking, TMC or USB488 devices will be selected
 *             if (usb.util.find_descriptor(cfg, bInterfaceClass=0xfe, bInterfaceSubClass=3) != None):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_util); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_find_descriptor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_cfg);
    __Pyx_GIVEREF(__pyx_v_cfg);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_cfg);
    __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bInterfaceClass, __pyx_int_254) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bInterfaceSubClass, __pyx_int_3) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_8) {

      /* "cPyUSBTMC.pyx":83
 *             # strictry speaking, TMC or USB488 devices will be selected
 *             if (usb.util.find_descriptor(cfg, bInterfaceClass=0xfe, bInterfaceSubClass=3) != None):
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "cPyUSBTMC.pyx":82
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 *             # strictry speaking, TMC or USB488 devices will be selected
 *             if (usb.util.find_descriptor(cfg, bInterfaceClass=0xfe, bInterfaceSubClass=3) != None):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    }

    /* "cPyUSBTMC.pyx":79
 *     """
 *     def is_usbtmc(d):
 *         for cfg in d:             # <<<<<<<<<<<<<<
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 *             # strictry speaking, TMC or USB488 devices will be selected
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":84
 *             if (usb.util.find_descriptor(cfg, bInterfaceClass=0xfe, bInterfaceSubClass=3) != None):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     devs=usb.core.find(find_all=True, custom_match=is_usbtmc)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":78
 *     value from this function.  The user can use USBTMC_device.find_all() and USB488_device.find_all().
 *     """
 *     def is_usbtmc(d):             # <<<<<<<<<<<<<<
 *         for cfg in d:
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cPyUSBTMC.find_tmc_devices.is_usbtmc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cfg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":70
 * # it means 'use "<" in pack/unpack of struct module.'
 * 
 * def find_tmc_devices():             # <<<<<<<<<<<<<<
 *     """
 *     get the list of USB devices which belongs USBTMC Class.
 */

static PyObject *__pyx_pf_9cPyUSBTMC_find_tmc_devices(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_is_usbtmc = 0;
  PyObject *__pyx_v_devs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_tmc_devices", 0);

  /* "cPyUSBTMC.pyx":78
 *     value from this function.  The user can use USBTMC_device.find_all() and USB488_device.find_all().
 *     """
 *     def is_usbtmc(d):             # <<<<<<<<<<<<<<
 *         for cfg in d:
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_16find_tmc_devices_1is_usbtmc, 0, __pyx_n_s_find_tmc_devices_locals_is_usbtm, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_is_usbtmc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":86
 *         return False
 * 
 *     devs=usb.core.find(find_all=True, custom_match=is_usbtmc)             # <<<<<<<<<<<<<<
 *     return devs # a list of usb.core.Device
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_usb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_core); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_find_all, Py_True) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_custom_match, __pyx_v_is_usbtmc) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_devs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":87
 * 
 *     devs=usb.core.find(find_all=True, custom_match=is_usbtmc)
 *     return devs # a list of usb.core.Device             # <<<<<<<<<<<<<<
 * 
 * # Table11 Bulk-IN protocol error
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_devs);
  __pyx_r = __pyx_v_devs;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":70
 * # it means 'use "<" in pack/unpack of struct module.'
 * 
 * def find_tmc_devices():             # <<<<<<<<<<<<<<
 *     """
 *     get the list of USB devices which belongs USBTMC Class.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.find_tmc_devices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_is_usbtmc);
  __Pyx_XDECREF(__pyx_v_devs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":98
 * #
 * class usbtmc_dev_capabilities:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.interface_capabilities=""
 *         self.device_capabilities=""
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_23usbtmc_dev_capabilities_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_23usbtmc_dev_capabilities_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cPyUSBTMC_23usbtmc_dev_capabilities_1__init__, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_23usbtmc_dev_capabilities_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_23usbtmc_dev_capabilities___init__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_23usbtmc_dev_capabilities___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":99
 * class usbtmc_dev_capabilities:
 *     def __init__(self):
 *         self.interface_capabilities=""             # <<<<<<<<<<<<<<
 *         self.device_capabilities=""
 *         self.usb488_interface_capabilities=""
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_interface_capabilities, __pyx_kp_s__3) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":100
 *     def __init__(self):
 *         self.interface_capabilities=""
 *         self.device_capabilities=""             # <<<<<<<<<<<<<<
 *         self.usb488_interface_capabilities=""
 *         self.usb488_device_capabilities=""
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_device_capabilities, __pyx_kp_s__3) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":101
 *         self.interface_capabilities=""
 *         self.device_capabilities=""
 *         self.usb488_interface_capabilities=""             # <<<<<<<<<<<<<<
 *         self.usb488_device_capabilities=""
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_usb488_interface_capabilities, __pyx_kp_s__3) < 0) __PYX_ERR(0, 101, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":102
 *         self.device_capabilities=""
 *         self.usb488_interface_capabilities=""
 *         self.usb488_device_capabilities=""             # <<<<<<<<<<<<<<
 * 
 * class usbtmc_attribute:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_usb488_device_capabilities, __pyx_kp_s__3) < 0) __PYX_ERR(0, 102, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":98
 * #
 * class usbtmc_dev_capabilities:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.interface_capabilities=""
 *         self.device_capabilities=""
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cPyUSBTMC.usbtmc_dev_capabilities.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":105
 * 
 * class usbtmc_attribute:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.attribute=0
 *         self.value=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_16usbtmc_attribute_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_16usbtmc_attribute_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cPyUSBTMC_16usbtmc_attribute_1__init__, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_16usbtmc_attribute_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_16usbtmc_attribute___init__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_16usbtmc_attribute___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":106
 * class usbtmc_attribute:
 *     def __init__(self):
 *         self.attribute=0             # <<<<<<<<<<<<<<
 *         self.value=0
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attribute, __pyx_int_0) < 0) __PYX_ERR(0, 106, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":107
 *     def __init__(self):
 *         self.attribute=0
 *         self.value=0             # <<<<<<<<<<<<<<
 * 
 * # USBTMC status values/USBTMC Table 16
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_int_0) < 0) __PYX_ERR(0, 107, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":105
 * 
 * class usbtmc_attribute:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.attribute=0
 *         self.value=0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cPyUSBTMC.usbtmc_attribute.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":121
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.SUCCESS):
 *             return "Success"
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_Status_1msg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_Status_1msg = {"msg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_Status_1msg, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_Status_1msg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_i = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_i,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msg", 1, 2, 2, 1); __PYX_ERR(0, 121, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msg") < 0)) __PYX_ERR(0, 121, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_i = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_Status.msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_Status_msg(__pyx_self, __pyx_v_cls, __pyx_v_i);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_Status_msg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("msg", 0);

  /* "cPyUSBTMC.pyx":122
 *     @classmethod
 *     def msg(cls,i):
 *         if (i == cls.SUCCESS):             # <<<<<<<<<<<<<<
 *             return "Success"
 *         elif (i == cls.PENDING):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":123
 *     def msg(cls,i):
 *         if (i == cls.SUCCESS):
 *             return "Success"             # <<<<<<<<<<<<<<
 *         elif (i == cls.PENDING):
 *             return "Pending"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_Success);
    __pyx_r = __pyx_n_s_Success;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":122
 *     @classmethod
 *     def msg(cls,i):
 *         if (i == cls.SUCCESS):             # <<<<<<<<<<<<<<
 *             return "Success"
 *         elif (i == cls.PENDING):
 */
  }

  /* "cPyUSBTMC.pyx":124
 *         if (i == cls.SUCCESS):
 *             return "Success"
 *         elif (i == cls.PENDING):             # <<<<<<<<<<<<<<
 *             return "Pending"
 *         elif (i == cls.FAILED):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_PENDING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":125
 *             return "Success"
 *         elif (i == cls.PENDING):
 *             return "Pending"             # <<<<<<<<<<<<<<
 *         elif (i == cls.FAILED):
 *             return "Failed"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_Pending);
    __pyx_r = __pyx_n_s_Pending;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":124
 *         if (i == cls.SUCCESS):
 *             return "Success"
 *         elif (i == cls.PENDING):             # <<<<<<<<<<<<<<
 *             return "Pending"
 *         elif (i == cls.FAILED):
 */
  }

  /* "cPyUSBTMC.pyx":126
 *         elif (i == cls.PENDING):
 *             return "Pending"
 *         elif (i == cls.FAILED):             # <<<<<<<<<<<<<<
 *             return "Failed"
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_FAILED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":127
 *             return "Pending"
 *         elif (i == cls.FAILED):
 *             return "Failed"             # <<<<<<<<<<<<<<
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 *             return "Transfer not in progress"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_Failed);
    __pyx_r = __pyx_n_s_Failed;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":126
 *         elif (i == cls.PENDING):
 *             return "Pending"
 *         elif (i == cls.FAILED):             # <<<<<<<<<<<<<<
 *             return "Failed"
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 */
  }

  /* "cPyUSBTMC.pyx":128
 *         elif (i == cls.FAILED):
 *             return "Failed"
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Transfer not in progress"
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_TRANSFER_NOT_IN_PROGRESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":129
 *             return "Failed"
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 *             return "Transfer not in progress"             # <<<<<<<<<<<<<<
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 *             return "Split not in progress"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_Transfer_not_in_progress);
    __pyx_r = __pyx_kp_s_Transfer_not_in_progress;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":128
 *         elif (i == cls.FAILED):
 *             return "Failed"
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Transfer not in progress"
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 */
  }

  /* "cPyUSBTMC.pyx":130
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 *             return "Transfer not in progress"
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Split not in progress"
 *         elif (i == cls.SPLIT_IN_PROGRESS):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_SPLIT_NOT_IN_PROGRESS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":131
 *             return "Transfer not in progress"
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 *             return "Split not in progress"             # <<<<<<<<<<<<<<
 *         elif (i == cls.SPLIT_IN_PROGRESS):
 *             return "Split in progress"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_Split_not_in_progress);
    __pyx_r = __pyx_kp_s_Split_not_in_progress;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":130
 *         elif (i == cls.TRANSFER_NOT_IN_PROGRESS):
 *             return "Transfer not in progress"
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Split not in progress"
 *         elif (i == cls.SPLIT_IN_PROGRESS):
 */
  }

  /* "cPyUSBTMC.pyx":132
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 *             return "Split not in progress"
 *         elif (i == cls.SPLIT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Split in progress"
 *         return "Reserved"
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_SPLIT_IN_PROGRESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":133
 *             return "Split not in progress"
 *         elif (i == cls.SPLIT_IN_PROGRESS):
 *             return "Split in progress"             # <<<<<<<<<<<<<<
 *         return "Reserved"
 * #
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_Split_in_progress);
    __pyx_r = __pyx_kp_s_Split_in_progress;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":132
 *         elif (i == cls.SPLIT_NOT_IN_PROGRESS):
 *             return "Split not in progress"
 *         elif (i == cls.SPLIT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return "Split in progress"
 *         return "Reserved"
 */
  }

  /* "cPyUSBTMC.pyx":134
 *         elif (i == cls.SPLIT_IN_PROGRESS):
 *             return "Split in progress"
 *         return "Reserved"             # <<<<<<<<<<<<<<
 * #
 * class IEEE488_Status_Byte_Reg:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_s_Reserved);
  __pyx_r = __pyx_n_s_Reserved;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":121
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.SUCCESS):
 *             return "Success"
 */

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

/* "cPyUSBTMC.pyx":137
 * #
 * class IEEE488_Status_Byte_Reg:
 *     def __init__(self,byte):             # <<<<<<<<<<<<<<
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_23IEEE488_Status_Byte_Reg_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_23IEEE488_Status_Byte_Reg_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_23IEEE488_Status_Byte_Reg_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_23IEEE488_Status_Byte_Reg_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_byte = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_byte,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_byte)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 137, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 137, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_byte = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.IEEE488_Status_Byte_Reg.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_23IEEE488_Status_Byte_Reg___init__(__pyx_self, __pyx_v_self, __pyx_v_byte);

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

static PyObject *__pyx_pf_9cPyUSBTMC_23IEEE488_Status_Byte_Reg___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":138
 * class IEEE488_Status_Byte_Reg:
 *     def __init__(self,byte):
 *         self.raw    = byte             # <<<<<<<<<<<<<<
 *         self.OPER   =(byte & 0x80)>>7
 *         self.RQS_MSS=(byte & 0x40)>>6
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_raw, __pyx_v_byte) < 0) __PYX_ERR(0, 138, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":139
 *     def __init__(self,byte):
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7             # <<<<<<<<<<<<<<
 *         self.RQS_MSS=(byte & 0x40)>>6
 *         self.ESB    =(byte & 0x20)>>5
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_128, 0x80, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_RshiftObjC(__pyx_t_1, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_OPER, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":140
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7
 *         self.RQS_MSS=(byte & 0x40)>>6             # <<<<<<<<<<<<<<
 *         self.ESB    =(byte & 0x20)>>5
 *         self.MAV    =(byte & 0x10)>>4
 */
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_64, 0x40, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_RshiftObjC(__pyx_t_2, __pyx_int_6, 6, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_RQS_MSS, __pyx_t_1) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":141
 *         self.OPER   =(byte & 0x80)>>7
 *         self.RQS_MSS=(byte & 0x40)>>6
 *         self.ESB    =(byte & 0x20)>>5             # <<<<<<<<<<<<<<
 *         self.MAV    =(byte & 0x10)>>4
 *         self.MSG    =(byte & 0x04)>>2
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_32, 0x20, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_RshiftObjC(__pyx_t_1, __pyx_int_5, 5, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ESB, __pyx_t_2) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":142
 *         self.RQS_MSS=(byte & 0x40)>>6
 *         self.ESB    =(byte & 0x20)>>5
 *         self.MAV    =(byte & 0x10)>>4             # <<<<<<<<<<<<<<
 *         self.MSG    =(byte & 0x04)>>2
 *         self.USR    =(byte & 0x02)>>1
 */
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_16, 0x10, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_RshiftObjC(__pyx_t_2, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_MAV, __pyx_t_1) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":143
 *         self.ESB    =(byte & 0x20)>>5
 *         self.MAV    =(byte & 0x10)>>4
 *         self.MSG    =(byte & 0x04)>>2             # <<<<<<<<<<<<<<
 *         self.USR    =(byte & 0x02)>>1
 *         self.TRG    =(byte & 0x01)>>0
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_4, 0x04, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_RshiftObjC(__pyx_t_1, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_MSG, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":144
 *         self.MAV    =(byte & 0x10)>>4
 *         self.MSG    =(byte & 0x04)>>2
 *         self.USR    =(byte & 0x02)>>1             # <<<<<<<<<<<<<<
 *         self.TRG    =(byte & 0x01)>>0
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_2, 0x02, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_RshiftObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_USR, __pyx_t_1) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":145
 *         self.MSG    =(byte & 0x04)>>2
 *         self.USR    =(byte & 0x02)>>1
 *         self.TRG    =(byte & 0x01)>>0             # <<<<<<<<<<<<<<
 * 
 * class USB488_Status(USBTMC_Status):
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_byte, __pyx_int_1, 0x01, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Rshift(__pyx_t_1, __pyx_int_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TRG, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":137
 * #
 * class IEEE488_Status_Byte_Reg:
 *     def __init__(self,byte):             # <<<<<<<<<<<<<<
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7
 */

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

/* "cPyUSBTMC.pyx":150
 *     INTERRUPT_IN_BUSY=0x20
 * 
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_Status_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_Status_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_Status_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_Status_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 150, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 150, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_Status.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_Status___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_Status___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":151
 * 
 *     def __init__(self, bytes):
 *         self.USBTMC_status=bytes[0]             # <<<<<<<<<<<<<<
 *         self.bTag=bytes[1]
 *         self.SBR=IEEE488_Status_Byte_Reg(bytes[2])
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_USBTMC_status, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":152
 *     def __init__(self, bytes):
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]             # <<<<<<<<<<<<<<
 *         self.SBR=IEEE488_Status_Byte_Reg(bytes[2])
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bTag, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":153
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]
 *         self.SBR=IEEE488_Status_Byte_Reg(bytes[2])             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IEEE488_Status_Byte_Reg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SBR, __pyx_t_1) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":150
 *     INTERRUPT_IN_BUSY=0x20
 * 
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_Status.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":156
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.INTERRUPT_IN_BUSY):
 *             return "Interrupt in busy"
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_Status_3msg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_Status_3msg = {"msg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_Status_3msg, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_Status_3msg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_i = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_i,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msg", 1, 2, 2, 1); __PYX_ERR(0, 156, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msg") < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_i = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_Status.msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_Status_2msg(__pyx_self, __pyx_v_cls, __pyx_v_i);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_Status_2msg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("msg", 0);

  /* "cPyUSBTMC.pyx":157
 *     @classmethod
 *     def msg(cls,i):
 *         if (i == cls.INTERRUPT_IN_BUSY):             # <<<<<<<<<<<<<<
 *             return "Interrupt in busy"
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_INTERRUPT_IN_BUSY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":158
 *     def msg(cls,i):
 *         if (i == cls.INTERRUPT_IN_BUSY):
 *             return "Interrupt in busy"             # <<<<<<<<<<<<<<
 *         else:
 *             return USBTMC_Status.msg(i)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_Interrupt_in_busy);
    __pyx_r = __pyx_kp_s_Interrupt_in_busy;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":157
 *     @classmethod
 *     def msg(cls,i):
 *         if (i == cls.INTERRUPT_IN_BUSY):             # <<<<<<<<<<<<<<
 *             return "Interrupt in busy"
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":160
 *             return "Interrupt in busy"
 *         else:
 *             return USBTMC_Status.msg(i)             # <<<<<<<<<<<<<<
 * 
 * #USBTMC requests values/USBTMC Table 15
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_i) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_i);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __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;
  }

  /* "cPyUSBTMC.pyx":156
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.INTERRUPT_IN_BUSY):
 *             return "Interrupt in busy"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_Status.msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":195
 *     #
 *     @classmethod
 *     def find_all(cls):             # <<<<<<<<<<<<<<
 *         usbdevs=find_tmc_devices()
 *         return [cls(dev) for dev in usbdevs]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_1find_all(PyObject *__pyx_self, PyObject *__pyx_v_cls); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_1find_all = {"find_all", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_1find_all, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_1find_all(PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_all (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_find_all(__pyx_self, ((PyObject *)__pyx_v_cls));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_find_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_v_usbdevs = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_all", 0);

  /* "cPyUSBTMC.pyx":196
 *     @classmethod
 *     def find_all(cls):
 *         usbdevs=find_tmc_devices()             # <<<<<<<<<<<<<<
 *         return [cls(dev) for dev in usbdevs]
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_find_tmc_devices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_usbdevs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":197
 *     def find_all(cls):
 *         usbdevs=find_tmc_devices()
 *         return [cls(dev) for dev in usbdevs]             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self,device):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_v_usbdevs)) || PyTuple_CheckExact(__pyx_v_usbdevs)) {
    __pyx_t_2 = __pyx_v_usbdevs; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_usbdevs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 197, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_dev, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_t_6 = __pyx_v_cls; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_dev) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_dev);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 197, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":195
 *     #
 *     @classmethod
 *     def find_all(cls):             # <<<<<<<<<<<<<<
 *         usbdevs=find_tmc_devices()
 *         return [cls(dev) for dev in usbdevs]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.find_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_usbdevs);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":199
 *         return [cls(dev) for dev in usbdevs]
 * 
 *     def __init__(self,device):             # <<<<<<<<<<<<<<
 *         # device:usb.core.Device
 *         self.device=device
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_3__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_3__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_3__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_3__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_device = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_device,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_device)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 199, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 199, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_device = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_2__init__(__pyx_self, __pyx_v_self, __pyx_v_device);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_2__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_device) {
  PyObject *__pyx_v_cnf = NULL;
  PyObject *__pyx_v_intf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":201
 *     def __init__(self,device):
 *         # device:usb.core.Device
 *         self.device=device             # <<<<<<<<<<<<<<
 *         if self.device.is_kernel_driver_active(0):
 *             self.device.detach_kernel_driver(0)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_device, __pyx_v_device) < 0) __PYX_ERR(0, 201, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":202
 *         # device:usb.core.Device
 *         self.device=device
 *         if self.device.is_kernel_driver_active(0):             # <<<<<<<<<<<<<<
 *             self.device.detach_kernel_driver(0)
 *         self.device.set_configuration()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_kernel_driver_active); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_0);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":203
 *         self.device=device
 *         if self.device.is_kernel_driver_active(0):
 *             self.device.detach_kernel_driver(0)             # <<<<<<<<<<<<<<
 *         self.device.set_configuration()
 *         self.device.set_interface_altsetting()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_detach_kernel_driver); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __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;

    /* "cPyUSBTMC.pyx":202
 *         # device:usb.core.Device
 *         self.device=device
 *         if self.device.is_kernel_driver_active(0):             # <<<<<<<<<<<<<<
 *             self.device.detach_kernel_driver(0)
 *         self.device.set_configuration()
 */
  }

  /* "cPyUSBTMC.pyx":204
 *         if self.device.is_kernel_driver_active(0):
 *             self.device.detach_kernel_driver(0)
 *         self.device.set_configuration()             # <<<<<<<<<<<<<<
 *         self.device.set_interface_altsetting()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_configuration); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __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;

  /* "cPyUSBTMC.pyx":205
 *             self.device.detach_kernel_driver(0)
 *         self.device.set_configuration()
 *         self.device.set_interface_altsetting()             # <<<<<<<<<<<<<<
 * 
 *         for cnf in self.device:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_set_interface_altsetting); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __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;

  /* "cPyUSBTMC.pyx":207
 *         self.device.set_interface_altsetting()
 * 
 *         for cnf in self.device:             # <<<<<<<<<<<<<<
 *             for intf in cnf:
 *                 #check if this device has TMC/USB488 interface
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __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_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 207, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_cnf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":208
 * 
 *         for cnf in self.device:
 *             for intf in cnf:             # <<<<<<<<<<<<<<
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and
 */
    if (likely(PyList_CheckExact(__pyx_v_cnf)) || PyTuple_CheckExact(__pyx_v_cnf)) {
      __pyx_t_1 = __pyx_v_cnf; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cnf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_8(__pyx_t_1);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 208, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_intf, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":210
 *             for intf in cnf:
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and             # <<<<<<<<<<<<<<
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):
 *                     self.__init_data__()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_intf, __pyx_n_s_bInterfaceClass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_USBTMC_bInterfaceClass); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_11) {
      } else {
        __pyx_t_4 = __pyx_t_11;
        goto __pyx_L9_bool_binop_done;
      }

      /* "cPyUSBTMC.pyx":211
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):             # <<<<<<<<<<<<<<
 *                     self.__init_data__()
 *                     self.getendpoints(cnf, intf)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_intf, __pyx_n_s_bInterfaceSubClass); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_USBTMC_bInterfaceSubClass); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_11;
      __pyx_L9_bool_binop_done:;

      /* "cPyUSBTMC.pyx":210
 *             for intf in cnf:
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and             # <<<<<<<<<<<<<<
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):
 *                     self.__init_data__()
 */
      if (__pyx_t_4) {

        /* "cPyUSBTMC.pyx":212
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):
 *                     self.__init_data__()             # <<<<<<<<<<<<<<
 *                     self.getendpoints(cnf, intf)
 *                     time.sleep(0.01)
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_init_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":213
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):
 *                     self.__init_data__()
 *                     self.getendpoints(cnf, intf)             # <<<<<<<<<<<<<<
 *                     time.sleep(0.01)
 *                     self.get_capabilities() # set self.capabilities
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_getendpoints); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_cnf, __pyx_v_intf};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_cnf, __pyx_v_intf};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_v_cnf);
          __Pyx_GIVEREF(__pyx_v_cnf);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_cnf);
          __Pyx_INCREF(__pyx_v_intf);
          __Pyx_GIVEREF(__pyx_v_intf);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_v_intf);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":214
 *                     self.__init_data__()
 *                     self.getendpoints(cnf, intf)
 *                     time.sleep(0.01)             # <<<<<<<<<<<<<<
 *                     self.get_capabilities() # set self.capabilities
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_time); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sleep); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
          }
        }
        __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_9, __pyx_float_0_01) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_float_0_01);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":215
 *                     self.getendpoints(cnf, intf)
 *                     time.sleep(0.01)
 *                     self.get_capabilities() # set self.capabilities             # <<<<<<<<<<<<<<
 * 
 *                     self.bulk_in.clear_halt()
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_capabilities); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
          }
        }
        __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":217
 *                     self.get_capabilities() # set self.capabilities
 * 
 *                     self.bulk_in.clear_halt()             # <<<<<<<<<<<<<<
 *                     self.bulk_out.clear_halt()
 *                     if self.intr_in:
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":218
 * 
 *                     self.bulk_in.clear_halt()
 *                     self.bulk_out.clear_halt()             # <<<<<<<<<<<<<<
 *                     if self.intr_in:
 *                         self.intr_in.clear_halt()
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 218, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
          }
        }
        __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":219
 *                     self.bulk_in.clear_halt()
 *                     self.bulk_out.clear_halt()
 *                     if self.intr_in:             # <<<<<<<<<<<<<<
 *                         self.intr_in.clear_halt()
 *                     return
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_4) {

          /* "cPyUSBTMC.pyx":220
 *                     self.bulk_out.clear_halt()
 *                     if self.intr_in:
 *                         self.intr_in.clear_halt()             # <<<<<<<<<<<<<<
 *                     return
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 */
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
            }
          }
          __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "cPyUSBTMC.pyx":219
 *                     self.bulk_in.clear_halt()
 *                     self.bulk_out.clear_halt()
 *                     if self.intr_in:             # <<<<<<<<<<<<<<
 *                         self.intr_in.clear_halt()
 *                     return
 */
        }

        /* "cPyUSBTMC.pyx":221
 *                     if self.intr_in:
 *                         self.intr_in.clear_halt()
 *                     return             # <<<<<<<<<<<<<<
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L0;

        /* "cPyUSBTMC.pyx":210
 *             for intf in cnf:
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and             # <<<<<<<<<<<<<<
 *                     (intf.bInterfaceSubClass == USBTMC_bInterfaceSubClass)):
 *                     self.__init_data__()
 */
      }

      /* "cPyUSBTMC.pyx":208
 * 
 *         for cnf in self.device:
 *             for intf in cnf:             # <<<<<<<<<<<<<<
 *                 #check if this device has TMC/USB488 interface
 *                 if ((intf.bInterfaceClass == USBTMC_bInterfaceClass) and
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":207
 *         self.device.set_interface_altsetting()
 * 
 *         for cnf in self.device:             # <<<<<<<<<<<<<<
 *             for intf in cnf:
 *                 #check if this device has TMC/USB488 interface
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":222
 *                         self.intr_in.clear_halt()
 *                     return
 *         raise USBError("the device is not USBTMC/USB488 Class device")             # <<<<<<<<<<<<<<
 * 
 *     def __init_data__(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_kp_s_the_device_is_not_USBTMC_USB488) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_the_device_is_not_USBTMC_USB488);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __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_ERR(0, 222, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":199
 *         return [cls(dev) for dev in usbdevs]
 * 
 *     def __init__(self,device):             # <<<<<<<<<<<<<<
 *         # device:usb.core.Device
 *         self.device=device
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cnf);
  __Pyx_XDECREF(__pyx_v_intf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":224
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 * 
 *     def __init_data__(self):             # <<<<<<<<<<<<<<
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_5__init_data__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_5__init_data__ = {"__init_data__", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_5__init_data__, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_5__init_data__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init_data__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_4__init_data__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_4__init_data__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init_data__", 0);

  /* "cPyUSBTMC.pyx":225
 * 
 *     def __init_data__(self):
 *         self.last_write_bTag=0             # <<<<<<<<<<<<<<
 *         self.last_read_bTag=0
 *         self.eof=0
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_write_bTag, __pyx_int_0) < 0) __PYX_ERR(0, 225, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":226
 *     def __init_data__(self):
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0             # <<<<<<<<<<<<<<
 *         self.eof=0
 *         self.retry_buf=""
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_read_bTag, __pyx_int_0) < 0) __PYX_ERR(0, 226, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":227
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0
 *         self.eof=0             # <<<<<<<<<<<<<<
 *         self.retry_buf=""
 *         self.timeout=USBTMC_DEFAULT_TIMEOUT
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_eof, __pyx_int_0) < 0) __PYX_ERR(0, 227, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":228
 *         self.last_read_bTag=0
 *         self.eof=0
 *         self.retry_buf=""             # <<<<<<<<<<<<<<
 *         self.timeout=USBTMC_DEFAULT_TIMEOUT
 *         self.term_char_enabled=False
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_retry_buf, __pyx_kp_s__3) < 0) __PYX_ERR(0, 228, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":229
 *         self.eof=0
 *         self.retry_buf=""
 *         self.timeout=USBTMC_DEFAULT_TIMEOUT             # <<<<<<<<<<<<<<
 *         self.term_char_enabled=False
 *         self.term_char="\n"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_DEFAULT_TIMEOUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":230
 *         self.retry_buf=""
 *         self.timeout=USBTMC_DEFAULT_TIMEOUT
 *         self.term_char_enabled=False             # <<<<<<<<<<<<<<
 *         self.term_char="\n"
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_term_char_enabled, Py_False) < 0) __PYX_ERR(0, 230, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":231
 *         self.timeout=USBTMC_DEFAULT_TIMEOUT
 *         self.term_char_enabled=False
 *         self.term_char="\n"             # <<<<<<<<<<<<<<
 * 
 *     def __del__(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_term_char, __pyx_kp_s__4) < 0) __PYX_ERR(0, 231, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":224
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 * 
 *     def __init_data__(self):             # <<<<<<<<<<<<<<
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.__init_data__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":233
 *         self.term_char="\n"
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_7__del__ = {"__del__", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_7__del__, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_6__del__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  char const *__pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "cPyUSBTMC.pyx":236
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 *         if self.device :             # <<<<<<<<<<<<<<
 *             # try:
 *             #     self.clear_bulk_out_halt()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":249
 *             # # othewise other program cannot access device later, until the connection to the device is reset
 *             # # by power off/on or diconnecting/reconnecting USB cable, etc.
 *             try:             # <<<<<<<<<<<<<<
 *                 dispose_resources(self.device)
 *             except:
 */
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        /*try:*/ {

          /* "cPyUSBTMC.pyx":250
 *             # # by power off/on or diconnecting/reconnecting USB cable, etc.
 *             try:
 *                 dispose_resources(self.device)             # <<<<<<<<<<<<<<
 *             except:
 *                 raise USBError("dispose_resoruce")
 */
          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_dispose_resources); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cPyUSBTMC.pyx":249
 *             # # othewise other program cannot access device later, until the connection to the device is reset
 *             # # by power off/on or diconnecting/reconnecting USB cable, etc.
 *             try:             # <<<<<<<<<<<<<<
 *                 dispose_resources(self.device)
 *             except:
 */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cPyUSBTMC.pyx":251
 *             try:
 *                 dispose_resources(self.device)
 *             except:             # <<<<<<<<<<<<<<
 *                 raise USBError("dispose_resoruce")
 *             finally:
 */
        /*except:*/ {
          __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 251, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cPyUSBTMC.pyx":252
 *                 dispose_resources(self.device)
 *             except:
 *                 raise USBError("dispose_resoruce")             # <<<<<<<<<<<<<<
 *             finally:
 *                 self.device=None
 */
          __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_USBError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 252, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
            }
          }
          __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_n_s_dispose_resoruce) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_n_s_dispose_resoruce);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 252, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(0, 252, __pyx_L9_except_error)
        }
        __pyx_L9_except_error:;

        /* "cPyUSBTMC.pyx":249
 *             # # othewise other program cannot access device later, until the connection to the device is reset
 *             # # by power off/on or diconnecting/reconnecting USB cable, etc.
 *             try:             # <<<<<<<<<<<<<<
 *                 dispose_resources(self.device)
 *             except:
 */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        goto __pyx_L5_error;
        __pyx_L12_try_end:;
      }
    }

    /* "cPyUSBTMC.pyx":254
 *                 raise USBError("dispose_resoruce")
 *             finally:
 *                 self.device=None             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    /*finally:*/ {
      /*normal exit:*/{
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_device, Py_None) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
        goto __pyx_L6;
      }
      __pyx_L5_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_16);
        __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
        {
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_device, Py_None) < 0) __PYX_ERR(0, 254, __pyx_L16_error)
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
        }
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
        __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
        __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
        goto __pyx_L1_error;
        __pyx_L16_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L6:;
    }

    /* "cPyUSBTMC.pyx":236
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 *         if self.device :             # <<<<<<<<<<<<<<
 *             # try:
 *             #     self.clear_bulk_out_halt()
 */
  }

  /* "cPyUSBTMC.pyx":255
 *             finally:
 *                 self.device=None
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def getendpoints(self, cnf, intf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":233
 *         self.term_char="\n"
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":257
 *         return
 * 
 *     def getendpoints(self, cnf, intf):             # <<<<<<<<<<<<<<
 *         self.intf = intf
 *         #intf.set_altsetting()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_9getendpoints(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_9getendpoints = {"getendpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_9getendpoints, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_9getendpoints(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_cnf = 0;
  PyObject *__pyx_v_intf = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getendpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cnf,&__pyx_n_s_intf,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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cnf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getendpoints", 1, 3, 3, 1); __PYX_ERR(0, 257, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getendpoints", 1, 3, 3, 2); __PYX_ERR(0, 257, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getendpoints") < 0)) __PYX_ERR(0, 257, __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_self = values[0];
    __pyx_v_cnf = values[1];
    __pyx_v_intf = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getendpoints", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 257, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.getendpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_8getendpoints(__pyx_self, __pyx_v_self, __pyx_v_cnf, __pyx_v_intf);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_8getendpoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_cnf, PyObject *__pyx_v_intf) {
  PyObject *__pyx_v_num_endpoints = NULL;
  PyObject *__pyx_v_ep = NULL;
  PyObject *__pyx_v_attr = NULL;
  PyObject *__pyx_v_direction = NULL;
  PyObject *__pyx_v_ep_type = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getendpoints", 0);

  /* "cPyUSBTMC.pyx":258
 * 
 *     def getendpoints(self, cnf, intf):
 *         self.intf = intf             # <<<<<<<<<<<<<<
 *         #intf.set_altsetting()
 *         #self.setting = self.intf.get_active_setting()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_intf, __pyx_v_intf) < 0) __PYX_ERR(0, 258, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":261
 *         #intf.set_altsetting()
 *         #self.setting = self.intf.get_active_setting()
 *         num_endpoints = self.intf.bNumEndpoints             # <<<<<<<<<<<<<<
 *         if (num_endpoints < 2):
 *             raise USBError("USBTMC should have at least 2  endpoints but not %d"%num_endpoints)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bNumEndpoints); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_num_endpoints = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":262
 *         #self.setting = self.intf.get_active_setting()
 *         num_endpoints = self.intf.bNumEndpoints
 *         if (num_endpoints < 2):             # <<<<<<<<<<<<<<
 *             raise USBError("USBTMC should have at least 2  endpoints but not %d"%num_endpoints)
 *         #find and setup endpoints
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_num_endpoints, __pyx_int_2, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "cPyUSBTMC.pyx":263
 *         num_endpoints = self.intf.bNumEndpoints
 *         if (num_endpoints < 2):
 *             raise USBError("USBTMC should have at least 2  endpoints but not %d"%num_endpoints)             # <<<<<<<<<<<<<<
 *         #find and setup endpoints
 *         self.bulk_out = None #intf[0]normally
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_USBTMC_should_have_at_least_2_en, __pyx_v_num_endpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __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_ERR(0, 263, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":262
 *         #self.setting = self.intf.get_active_setting()
 *         num_endpoints = self.intf.bNumEndpoints
 *         if (num_endpoints < 2):             # <<<<<<<<<<<<<<
 *             raise USBError("USBTMC should have at least 2  endpoints but not %d"%num_endpoints)
 *         #find and setup endpoints
 */
  }

  /* "cPyUSBTMC.pyx":265
 *             raise USBError("USBTMC should have at least 2  endpoints but not %d"%num_endpoints)
 *         #find and setup endpoints
 *         self.bulk_out = None #intf[0]normally             # <<<<<<<<<<<<<<
 *         self.bulk_in = None  #intf[1]
 *         self.intr_in = None  #intf[2]
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out, Py_None) < 0) __PYX_ERR(0, 265, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":266
 *         #find and setup endpoints
 *         self.bulk_out = None #intf[0]normally
 *         self.bulk_in = None  #intf[1]             # <<<<<<<<<<<<<<
 *         self.intr_in = None  #intf[2]
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in, Py_None) < 0) __PYX_ERR(0, 266, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":267
 *         self.bulk_out = None #intf[0]normally
 *         self.bulk_in = None  #intf[1]
 *         self.intr_in = None  #intf[2]             # <<<<<<<<<<<<<<
 * 
 *         for ep in intf:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_intr_in, Py_None) < 0) __PYX_ERR(0, 267, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":269
 *         self.intr_in = None  #intf[2]
 * 
 *         for ep in intf:             # <<<<<<<<<<<<<<
 *             attr = ep.bmAttributes
 *             direction = ep.bEndpointAddress & usb.ENDPOINT_DIR_MASK # can be replaced with usb.util.endpoint_direction(e.bEndpointAddress)
 */
  if (likely(PyList_CheckExact(__pyx_v_intf)) || PyTuple_CheckExact(__pyx_v_intf)) {
    __pyx_t_2 = __pyx_v_intf; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_intf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 269, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 269, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 269, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 269, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_ep, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":270
 * 
 *         for ep in intf:
 *             attr = ep.bmAttributes             # <<<<<<<<<<<<<<
 *             direction = ep.bEndpointAddress & usb.ENDPOINT_DIR_MASK # can be replaced with usb.util.endpoint_direction(e.bEndpointAddress)
 *             ep_type = attr & usb.ENDPOINT_TYPE_MASK # can be replaced with usb.util.endpoint_type(e.bmAttributes)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ep, __pyx_n_s_bmAttributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_attr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":271
 *         for ep in intf:
 *             attr = ep.bmAttributes
 *             direction = ep.bEndpointAddress & usb.ENDPOINT_DIR_MASK # can be replaced with usb.util.endpoint_direction(e.bEndpointAddress)             # <<<<<<<<<<<<<<
 *             ep_type = attr & usb.ENDPOINT_TYPE_MASK # can be replaced with usb.util.endpoint_type(e.bmAttributes)
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ep, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_DIR_MASK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_And(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_direction, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":272
 *             attr = ep.bmAttributes
 *             direction = ep.bEndpointAddress & usb.ENDPOINT_DIR_MASK # can be replaced with usb.util.endpoint_direction(e.bEndpointAddress)
 *             ep_type = attr & usb.ENDPOINT_TYPE_MASK # can be replaced with usb.util.endpoint_type(e.bmAttributes)             # <<<<<<<<<<<<<<
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_TYPE_MASK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_And(__pyx_v_attr, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ep_type, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":274
 *             ep_type = attr & usb.ENDPOINT_TYPE_MASK # can be replaced with usb.util.endpoint_type(e.bmAttributes)
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):             # <<<<<<<<<<<<<<
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.bulk_in=ep
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_TYPE_BULK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_ep_type, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "cPyUSBTMC.pyx":275
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):
 *                 if (direction == usb.ENDPOINT_IN):             # <<<<<<<<<<<<<<
 *                     self.bulk_in=ep
 *                 elif (direction == usb.ENDPOINT_OUT):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_direction, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "cPyUSBTMC.pyx":276
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.bulk_in=ep             # <<<<<<<<<<<<<<
 *                 elif (direction == usb.ENDPOINT_OUT):
 *                     self.bulk_out=ep
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in, __pyx_v_ep) < 0) __PYX_ERR(0, 276, __pyx_L1_error)

        /* "cPyUSBTMC.pyx":275
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):
 *                 if (direction == usb.ENDPOINT_IN):             # <<<<<<<<<<<<<<
 *                     self.bulk_in=ep
 *                 elif (direction == usb.ENDPOINT_OUT):
 */
        goto __pyx_L7;
      }

      /* "cPyUSBTMC.pyx":277
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.bulk_in=ep
 *                 elif (direction == usb.ENDPOINT_OUT):             # <<<<<<<<<<<<<<
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_OUT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_direction, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 277, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "cPyUSBTMC.pyx":278
 *                     self.bulk_in=ep
 *                 elif (direction == usb.ENDPOINT_OUT):
 *                     self.bulk_out=ep             # <<<<<<<<<<<<<<
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 *                 if (direction == usb.ENDPOINT_IN):
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out, __pyx_v_ep) < 0) __PYX_ERR(0, 278, __pyx_L1_error)

        /* "cPyUSBTMC.pyx":277
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.bulk_in=ep
 *                 elif (direction == usb.ENDPOINT_OUT):             # <<<<<<<<<<<<<<
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 */
      }
      __pyx_L7:;

      /* "cPyUSBTMC.pyx":274
 *             ep_type = attr & usb.ENDPOINT_TYPE_MASK # can be replaced with usb.util.endpoint_type(e.bmAttributes)
 *             #show_endpoint(self.device, self.intf.configuration,self.intf,ep)
 *             if (ep_type == usb.ENDPOINT_TYPE_BULK):             # <<<<<<<<<<<<<<
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.bulk_in=ep
 */
      goto __pyx_L6;
    }

    /* "cPyUSBTMC.pyx":279
 *                 elif (direction == usb.ENDPOINT_OUT):
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):             # <<<<<<<<<<<<<<
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.intr_in = ep
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_TYPE_INTERRUPT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_ep_type, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "cPyUSBTMC.pyx":280
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 *                 if (direction == usb.ENDPOINT_IN):             # <<<<<<<<<<<<<<
 *                     self.intr_in = ep
 *         if (self.bulk_in and self.bulk_out):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_direction, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "cPyUSBTMC.pyx":281
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.intr_in = ep             # <<<<<<<<<<<<<<
 *         if (self.bulk_in and self.bulk_out):
 *             return
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_intr_in, __pyx_v_ep) < 0) __PYX_ERR(0, 281, __pyx_L1_error)

        /* "cPyUSBTMC.pyx":280
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):
 *                 if (direction == usb.ENDPOINT_IN):             # <<<<<<<<<<<<<<
 *                     self.intr_in = ep
 *         if (self.bulk_in and self.bulk_out):
 */
      }

      /* "cPyUSBTMC.pyx":279
 *                 elif (direction == usb.ENDPOINT_OUT):
 *                     self.bulk_out=ep
 *             elif (ep_type == usb.ENDPOINT_TYPE_INTERRUPT):             # <<<<<<<<<<<<<<
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.intr_in = ep
 */
    }
    __pyx_L6:;

    /* "cPyUSBTMC.pyx":269
 *         self.intr_in = None  #intf[2]
 * 
 *         for ep in intf:             # <<<<<<<<<<<<<<
 *             attr = ep.bmAttributes
 *             direction = ep.bEndpointAddress & usb.ENDPOINT_DIR_MASK # can be replaced with usb.util.endpoint_direction(e.bEndpointAddress)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":282
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.intr_in = ep
 *         if (self.bulk_in and self.bulk_out):             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {
  } else {
    __pyx_t_3 = __pyx_t_8;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_8;
  __pyx_L10_bool_binop_done:;
  if (likely(__pyx_t_3)) {

    /* "cPyUSBTMC.pyx":283
 *                     self.intr_in = ep
 *         if (self.bulk_in and self.bulk_out):
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             raise USBError("TMC device must have both Bulk-In and Bulk-out endpoints.")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":282
 *                 if (direction == usb.ENDPOINT_IN):
 *                     self.intr_in = ep
 *         if (self.bulk_in and self.bulk_out):             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":285
 *             return
 *         else:
 *             raise USBError("TMC device must have both Bulk-In and Bulk-out endpoints.")             # <<<<<<<<<<<<<<
 * 
 *         #return # unreachable
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USBError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_TMC_device_must_have_both_Bulk_I) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_TMC_device_must_have_both_Bulk_I);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 285, __pyx_L1_error)
  }

  /* "cPyUSBTMC.pyx":257
 *         return
 * 
 *     def getendpoints(self, cnf, intf):             # <<<<<<<<<<<<<<
 *         self.intf = intf
 *         #intf.set_altsetting()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.getendpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_num_endpoints);
  __Pyx_XDECREF(__pyx_v_ep);
  __Pyx_XDECREF(__pyx_v_attr);
  __Pyx_XDECREF(__pyx_v_direction);
  __Pyx_XDECREF(__pyx_v_ep_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":290
 * 
 * 
 *     def isUSB488(self):             # <<<<<<<<<<<<<<
 *         if (self.intf.bInterfaceProtocol == 1):
 *             return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_11isUSB488(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_11isUSB488 = {"isUSB488", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_11isUSB488, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_11isUSB488(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isUSB488 (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_10isUSB488(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_10isUSB488(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isUSB488", 0);

  /* "cPyUSBTMC.pyx":291
 * 
 *     def isUSB488(self):
 *         if (self.intf.bInterfaceProtocol == 1):             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bInterfaceProtocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":292
 *     def isUSB488(self):
 *         if (self.intf.bInterfaceProtocol == 1):
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":291
 * 
 *     def isUSB488(self):
 *         if (self.intf.bInterfaceProtocol == 1):             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":294
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def usb_get_status(self,recipient=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cPyUSBTMC.pyx":290
 * 
 * 
 *     def isUSB488(self):             # <<<<<<<<<<<<<<
 *         if (self.intf.bInterfaceProtocol == 1):
 *             return True
 */

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

/* "cPyUSBTMC.pyx":296
 *             return False
 * 
 *     def usb_get_status(self,recipient=None):             # <<<<<<<<<<<<<<
 *         """
 *         recipient can be None(default) or Interfae or endpoint.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_13usb_get_status(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_12usb_get_status[] = "\n        recipient can be None(default) or Interfae or endpoint.\n        return values:\n            device:D1-Remote wakeup/D0-self powered\n            interface : 0x00,0x00\n            endpoint: D0-halt\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_13usb_get_status = {"usb_get_status", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_13usb_get_status, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_12usb_get_status};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_13usb_get_status(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_recipient = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("usb_get_status (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_recipient,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_recipient);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "usb_get_status") < 0)) __PYX_ERR(0, 296, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_recipient = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("usb_get_status", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 296, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.usb_get_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_12usb_get_status(__pyx_self, __pyx_v_self, __pyx_v_recipient);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_12usb_get_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_recipient) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("usb_get_status", 0);

  /* "cPyUSBTMC.pyx":304
 *             endpoint: D0-halt
 *         """
 *         return  usb.control.get_status(self.device, recipient)             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_usb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_control); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_status); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && 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;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_recipient};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_recipient};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_recipient);
    __Pyx_GIVEREF(__pyx_v_recipient);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_recipient);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __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;

  /* "cPyUSBTMC.pyx":296
 *             return False
 * 
 *     def usb_get_status(self,recipient=None):             # <<<<<<<<<<<<<<
 *         """
 *         recipient can be None(default) or Interfae or endpoint.
 */

  /* 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("cPyUSBTMC.USBTMC_device.usb_get_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":306
 *         return  usb.control.get_status(self.device, recipient)
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         return self.device.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_15reset(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_15reset = {"reset", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_15reset, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_15reset(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_14reset(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_14reset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "cPyUSBTMC.pyx":307
 * 
 *     def reset(self):
 *         return self.device.reset()             # <<<<<<<<<<<<<<
 * 
 *     def clear_halt(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":306
 *         return  usb.control.get_status(self.device, recipient)
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         return self.device.reset()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":309
 *         return self.device.reset()
 * 
 *     def clear_halt(self):             # <<<<<<<<<<<<<<
 *         """
 *         re-establish synchronization in all end-points.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_17clear_halt(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_16clear_halt[] = "\n        re-establish synchronization in all end-points.\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_17clear_halt = {"clear_halt", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_17clear_halt, METH_O, __pyx_doc_9cPyUSBTMC_13USBTMC_device_16clear_halt};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_17clear_halt(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_halt (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_16clear_halt(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_16clear_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_halt", 0);

  /* "cPyUSBTMC.pyx":313
 *         re-establish synchronization in all end-points.
 *         """
 *         self.bulk_in.clear_halt()             # <<<<<<<<<<<<<<
 *         self.bulk_out.clear_halt()
 *         if self.intr_in:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __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;

  /* "cPyUSBTMC.pyx":314
 *         """
 *         self.bulk_in.clear_halt()
 *         self.bulk_out.clear_halt()             # <<<<<<<<<<<<<<
 *         if self.intr_in:
 *             self.intr_in.clear_halt()
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __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;

  /* "cPyUSBTMC.pyx":315
 *         self.bulk_in.clear_halt()
 *         self.bulk_out.clear_halt()
 *         if self.intr_in:             # <<<<<<<<<<<<<<
 *             self.intr_in.clear_halt()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":316
 *         self.bulk_out.clear_halt()
 *         if self.intr_in:
 *             self.intr_in.clear_halt()             # <<<<<<<<<<<<<<
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __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;

    /* "cPyUSBTMC.pyx":315
 *         self.bulk_in.clear_halt()
 *         self.bulk_out.clear_halt()
 *         if self.intr_in:             # <<<<<<<<<<<<<<
 *             self.intr_in.clear_halt()
 * 
 */
  }

  /* "cPyUSBTMC.pyx":309
 *         return self.device.reset()
 * 
 *     def clear_halt(self):             # <<<<<<<<<<<<<<
 *         """
 *         re-establish synchronization in all end-points.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.clear_halt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":318
 *             self.intr_in.clear_halt()
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,             # <<<<<<<<<<<<<<
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_19ask0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_18ask0[] = " \n        A name borrowed from PyVISA module \n        return value: tuple of (data size, binary array of data)\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_19ask0 = {"ask0", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_19ask0, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_18ask0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_19ask0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cmd = 0;
  PyObject *__pyx_v_requestSize = 0;
  PyObject *__pyx_v_termChar = 0;
  PyObject *__pyx_v_termCharFlag = 0;
  PyObject *__pyx_v_io_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ask0 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cmd,&__pyx_n_s_requestSize,&__pyx_n_s_termChar,&__pyx_n_s_termCharFlag,&__pyx_n_s_io_timeout,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_IDN));
    values[2] = ((PyObject *)((PyObject *)__pyx_int_0));
    values[3] = ((PyObject *)((PyObject*)__pyx_kp_s__4));

    /* "cPyUSBTMC.pyx":319
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):             # <<<<<<<<<<<<<<
 *         """
 *         A name borrowed from PyVISA module
 */
    values[4] = ((PyObject *)((PyObject *)Py_True));
    values[5] = ((PyObject *)((PyObject *)__pyx_int_1000));
    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);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmd);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestSize);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termChar);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termCharFlag);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_io_timeout);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ask0") < 0)) __PYX_ERR(0, 318, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_cmd = values[1];
    __pyx_v_requestSize = values[2];
    __pyx_v_termChar = values[3];
    __pyx_v_termCharFlag = values[4];
    __pyx_v_io_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ask0", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 318, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.ask0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_18ask0(__pyx_self, __pyx_v_self, __pyx_v_cmd, __pyx_v_requestSize, __pyx_v_termChar, __pyx_v_termCharFlag, __pyx_v_io_timeout);

  /* "cPyUSBTMC.pyx":318
 *             self.intr_in.clear_halt()
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,             # <<<<<<<<<<<<<<
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):
 *         """
 */

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_18ask0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_termChar, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_io_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ask0", 0);

  /* "cPyUSBTMC.pyx":324
 *         return value: tuple of (data size, binary array of data)
 *         """
 *         self.device_write(cmd)             # <<<<<<<<<<<<<<
 *         return self.read0(io_timeout = io_timeout
 *                           , termChar = termChar
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_cmd) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cmd);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __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;

  /* "cPyUSBTMC.pyx":325
 *         """
 *         self.device_write(cmd)
 *         return self.read0(io_timeout = io_timeout             # <<<<<<<<<<<<<<
 *                           , termChar = termChar
 *                           , flag = termCharFlag
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_io_timeout, __pyx_v_io_timeout) < 0) __PYX_ERR(0, 325, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":326
 *         self.device_write(cmd)
 *         return self.read0(io_timeout = io_timeout
 *                           , termChar = termChar             # <<<<<<<<<<<<<<
 *                           , flag = termCharFlag
 *                           , requestSize = requestSize)
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termChar, __pyx_v_termChar) < 0) __PYX_ERR(0, 325, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":327
 *         return self.read0(io_timeout = io_timeout
 *                           , termChar = termChar
 *                           , flag = termCharFlag             # <<<<<<<<<<<<<<
 *                           , requestSize = requestSize)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_flag, __pyx_v_termCharFlag) < 0) __PYX_ERR(0, 325, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":328
 *                           , termChar = termChar
 *                           , flag = termCharFlag
 *                           , requestSize = requestSize)             # <<<<<<<<<<<<<<
 * 
 *     def ask(self, cmd="*IDN?\n",
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_requestSize, __pyx_v_requestSize) < 0) __PYX_ERR(0, 325, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":325
 *         """
 *         self.device_write(cmd)
 *         return self.read0(io_timeout = io_timeout             # <<<<<<<<<<<<<<
 *                           , termChar = termChar
 *                           , flag = termCharFlag
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":318
 *             self.intr_in.clear_halt()
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,             # <<<<<<<<<<<<<<
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.ask0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":330
 *                           , requestSize = requestSize)
 * 
 *     def ask(self, cmd="*IDN?\n",             # <<<<<<<<<<<<<<
 *             requestSize=0,
 *             termChar="\n",
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_21ask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_20ask[] = " \n        A name borrowed from PyVISA module \n        now return value as string. Old behaviour is available as ask0.\n        \"termCharFlag=False\" is 10 times faster than \"termChanFlag=True\" (at lease in some cases).\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_21ask = {"ask", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_21ask, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_20ask};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_21ask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cmd = 0;
  PyObject *__pyx_v_requestSize = 0;
  PyObject *__pyx_v_termChar = 0;
  PyObject *__pyx_v_termCharFlag = 0;
  PyObject *__pyx_v_io_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ask (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cmd,&__pyx_n_s_requestSize,&__pyx_n_s_termChar,&__pyx_n_s_termCharFlag,&__pyx_n_s_io_timeout,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_IDN));
    values[2] = ((PyObject *)((PyObject *)__pyx_int_0));
    values[3] = ((PyObject *)((PyObject*)__pyx_kp_s__4));

    /* "cPyUSBTMC.pyx":333
 *             requestSize=0,
 *             termChar="\n",
 *             termCharFlag=True,             # <<<<<<<<<<<<<<
 *             io_timeout=1000):
 *         """
 */
    values[4] = ((PyObject *)((PyObject *)Py_True));
    values[5] = ((PyObject *)((PyObject *)__pyx_int_1000));
    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);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmd);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestSize);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termChar);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termCharFlag);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_io_timeout);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ask") < 0)) __PYX_ERR(0, 330, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_cmd = values[1];
    __pyx_v_requestSize = values[2];
    __pyx_v_termChar = values[3];
    __pyx_v_termCharFlag = values[4];
    __pyx_v_io_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ask", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 330, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.ask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_20ask(__pyx_self, __pyx_v_self, __pyx_v_cmd, __pyx_v_requestSize, __pyx_v_termChar, __pyx_v_termCharFlag, __pyx_v_io_timeout);

  /* "cPyUSBTMC.pyx":330
 *                           , requestSize = requestSize)
 * 
 *     def ask(self, cmd="*IDN?\n",             # <<<<<<<<<<<<<<
 *             requestSize=0,
 *             termChar="\n",
 */

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_20ask(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_termChar, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_io_timeout) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ask", 0);

  /* "cPyUSBTMC.pyx":340
 *         "termCharFlag=False" is 10 times faster than "termChanFlag=True" (at lease in some cases).
 *         """
 *         self.device_write(cmd)             # <<<<<<<<<<<<<<
 *         data=self.read(requestSize=requestSize
 *                        , io_timeout=io_timeout
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_cmd) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cmd);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __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;

  /* "cPyUSBTMC.pyx":341
 *         """
 *         self.device_write(cmd)
 *         data=self.read(requestSize=requestSize             # <<<<<<<<<<<<<<
 *                        , io_timeout=io_timeout
 *                        , termChar=termChar
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_requestSize, __pyx_v_requestSize) < 0) __PYX_ERR(0, 341, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":342
 *         self.device_write(cmd)
 *         data=self.read(requestSize=requestSize
 *                        , io_timeout=io_timeout             # <<<<<<<<<<<<<<
 *                        , termChar=termChar
 *                        , flag=termCharFlag
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_io_timeout, __pyx_v_io_timeout) < 0) __PYX_ERR(0, 341, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":343
 *         data=self.read(requestSize=requestSize
 *                        , io_timeout=io_timeout
 *                        , termChar=termChar             # <<<<<<<<<<<<<<
 *                        , flag=termCharFlag
 *                        )
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termChar, __pyx_v_termChar) < 0) __PYX_ERR(0, 341, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":344
 *                        , io_timeout=io_timeout
 *                        , termChar=termChar
 *                        , flag=termCharFlag             # <<<<<<<<<<<<<<
 *                        )
 *         return data
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_flag, __pyx_v_termCharFlag) < 0) __PYX_ERR(0, 341, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":341
 *         """
 *         self.device_write(cmd)
 *         data=self.read(requestSize=requestSize             # <<<<<<<<<<<<<<
 *                        , io_timeout=io_timeout
 *                        , termChar=termChar
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_data = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":346
 *                        , flag=termCharFlag
 *                        )
 *         return data             # <<<<<<<<<<<<<<
 * 
 *     askS=ask
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_data);
  __pyx_r = __pyx_v_data;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":330
 *                           , requestSize = requestSize)
 * 
 *     def ask(self, cmd="*IDN?\n",             # <<<<<<<<<<<<<<
 *             requestSize=0,
 *             termChar="\n",
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.ask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":350
 *     askS=ask
 * 
 *     def read(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *              , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_23read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_22read[] = "\n        returns values as string. Old behaviour is now available as read0\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_23read = {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_23read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_22read};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_23read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_requestSize = 0;
  PyObject *__pyx_v_io_timeout = 0;
  CYTHON_UNUSED PyObject *__pyx_v_lock_timeout = 0;
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_v_termChar = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_requestSize,&__pyx_n_s_io_timeout,&__pyx_n_s_lock_timeout,&__pyx_n_s_flag,&__pyx_n_s_termChar,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)__pyx_int_0));
    values[2] = ((PyObject *)((PyObject *)__pyx_int_1000));
    values[3] = ((PyObject *)((PyObject *)__pyx_int_0));

    /* "cPyUSBTMC.pyx":351
 * 
 *     def read(self,requestSize=0, io_timeout=1000
 *              , lock_timeout=0, flag=False, termChar='\x00'):             # <<<<<<<<<<<<<<
 *         """
 *         returns values as string. Old behaviour is now available as read0
 */
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject*)__pyx_kp_s__5));
    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);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestSize);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_io_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lock_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termChar);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 350, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_requestSize = values[1];
    __pyx_v_io_timeout = values[2];
    __pyx_v_lock_timeout = values[3];
    __pyx_v_flag = values[4];
    __pyx_v_termChar = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 350, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_22read(__pyx_self, __pyx_v_self, __pyx_v_requestSize, __pyx_v_io_timeout, __pyx_v_lock_timeout, __pyx_v_flag, __pyx_v_termChar);

  /* "cPyUSBTMC.pyx":350
 *     askS=ask
 * 
 *     def read(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *              , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_22read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_io_timeout, CYTHON_UNUSED PyObject *__pyx_v_lock_timeout, PyObject *__pyx_v_flag, PyObject *__pyx_v_termChar) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_ndata = NULL;
  PyObject *__pyx_v_eom = NULL;
  PyObject *__pyx_v_rsize = NULL;
  int __pyx_v_termCharFlag;
  PyObject *__pyx_v_resp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "cPyUSBTMC.pyx":355
 *         returns values as string. Old behaviour is now available as read0
 *         """
 *         data=array.array('B') # null array             # <<<<<<<<<<<<<<
 *         ndata=0
 *         eom=False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_B) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_B);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":356
 *         """
 *         data=array.array('B') # null array
 *         ndata=0             # <<<<<<<<<<<<<<
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_ndata = __pyx_int_0;

  /* "cPyUSBTMC.pyx":357
 *         data=array.array('B') # null array
 *         ndata=0
 *         eom=False             # <<<<<<<<<<<<<<
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 *             rsize=requestSize
 */
  __Pyx_INCREF(Py_False);
  __pyx_v_eom = Py_False;

  /* "cPyUSBTMC.pyx":358
 *         ndata=0
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:             # <<<<<<<<<<<<<<
 *             rsize=requestSize
 *         else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_requestSize, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_requestSize, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":359
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 *             rsize=requestSize             # <<<<<<<<<<<<<<
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER
 */
    __Pyx_INCREF(__pyx_v_requestSize);
    __pyx_v_rsize = __pyx_v_requestSize;

    /* "cPyUSBTMC.pyx":358
 *         ndata=0
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:             # <<<<<<<<<<<<<<
 *             rsize=requestSize
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":361
 *             rsize=requestSize
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER             # <<<<<<<<<<<<<<
 *         termCharFlag=(True if (flag and (termChar != '\x00')) else False)
 *         while not (eom or
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rsize = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":362
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         termCharFlag=(True if (flag and (termChar != '\x00')) else False)             # <<<<<<<<<<<<<<
 *         while not (eom or
 *                    ((0 < requestSize) and
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_termChar, __pyx_kp_s__5, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {
    __pyx_t_4 = 1;
  } else {
    __pyx_t_4 = 0;
  }
  __pyx_v_termCharFlag = __pyx_t_4;

  /* "cPyUSBTMC.pyx":363
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         termCharFlag=(True if (flag and (termChar != '\x00')) else False)
 *         while not (eom or             # <<<<<<<<<<<<<<
 *                    ((0 < requestSize) and
 *                     (requestSize <= ndata))
 */
  while (1) {
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_eom); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 363, __pyx_L1_error)
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }

    /* "cPyUSBTMC.pyx":364
 *         termCharFlag=(True if (flag and (termChar != '\x00')) else False)
 *         while not (eom or
 *                    ((0 < requestSize) and             # <<<<<<<<<<<<<<
 *                     (requestSize <= ndata))
 *         ):
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_requestSize, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }

    /* "cPyUSBTMC.pyx":365
 *         while not (eom or
 *                    ((0 < requestSize) and
 *                     (requestSize <= ndata))             # <<<<<<<<<<<<<<
 *         ):
 *             resp=self.device_read(rsize, termCharFlag=termCharFlag,
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_requestSize, __pyx_v_ndata, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;

    /* "cPyUSBTMC.pyx":363
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         termCharFlag=(True if (flag and (termChar != '\x00')) else False)
 *         while not (eom or             # <<<<<<<<<<<<<<
 *                    ((0 < requestSize) and
 *                     (requestSize <= ndata))
 */
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (!__pyx_t_5) break;

    /* "cPyUSBTMC.pyx":367
 *                     (requestSize <= ndata))
 *         ):
 *             resp=self.device_read(rsize, termCharFlag=termCharFlag,             # <<<<<<<<<<<<<<
 *                                   termchar=termChar, timeout=io_timeout)
 *             ndata += resp.TransferSize
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_rsize);
    __Pyx_GIVEREF(__pyx_v_rsize);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rsize);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_termCharFlag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termCharFlag, __pyx_t_7) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "cPyUSBTMC.pyx":368
 *         ):
 *             resp=self.device_read(rsize, termCharFlag=termCharFlag,
 *                                   termchar=termChar, timeout=io_timeout)             # <<<<<<<<<<<<<<
 *             ndata += resp.TransferSize
 *             #data  += resp.data
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termchar, __pyx_v_termChar) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_v_io_timeout) < 0) __PYX_ERR(0, 367, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":367
 *                     (requestSize <= ndata))
 *         ):
 *             resp=self.device_read(rsize, termCharFlag=termCharFlag,             # <<<<<<<<<<<<<<
 *                                   termchar=termChar, timeout=io_timeout)
 *             ndata += resp.TransferSize
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_resp, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cPyUSBTMC.pyx":369
 *             resp=self.device_read(rsize, termCharFlag=termCharFlag,
 *                                   termchar=termChar, timeout=io_timeout)
 *             ndata += resp.TransferSize             # <<<<<<<<<<<<<<
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_TransferSize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_ndata, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_ndata, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":371
 *             ndata += resp.TransferSize
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])             # <<<<<<<<<<<<<<
 *             eom = resp.eom
 *             if eom:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_extend); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_TransferSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":372
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom             # <<<<<<<<<<<<<<
 *             if eom:
 *                 break
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_eom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_eom, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":373
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom
 *             if eom:             # <<<<<<<<<<<<<<
 *                 break
 *         return data.tostring()
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_eom); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 373, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "cPyUSBTMC.pyx":374
 *             eom = resp.eom
 *             if eom:
 *                 break             # <<<<<<<<<<<<<<
 *         return data.tostring()
 *     # for compatibility
 */
      goto __pyx_L7_break;

      /* "cPyUSBTMC.pyx":373
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom
 *             if eom:             # <<<<<<<<<<<<<<
 *                 break
 *         return data.tostring()
 */
    }
  }
  __pyx_L7_break:;

  /* "cPyUSBTMC.pyx":375
 *             if eom:
 *                 break
 *         return data.tostring()             # <<<<<<<<<<<<<<
 *     # for compatibility
 *     readS=read
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_tostring); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":350
 *     askS=ask
 * 
 *     def read(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *              , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_ndata);
  __Pyx_XDECREF(__pyx_v_eom);
  __Pyx_XDECREF(__pyx_v_rsize);
  __Pyx_XDECREF(__pyx_v_resp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":379
 *     readS=read
 * 
 *     def read0(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *               , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_25read0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_24read0[] = "\n        returns values as tuple of (data size, binary array data)\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_25read0 = {"read0", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_25read0, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_24read0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_25read0(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_requestSize = 0;
  PyObject *__pyx_v_io_timeout = 0;
  CYTHON_UNUSED PyObject *__pyx_v_lock_timeout = 0;
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_v_termChar = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read0 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_requestSize,&__pyx_n_s_io_timeout,&__pyx_n_s_lock_timeout,&__pyx_n_s_flag,&__pyx_n_s_termChar,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)__pyx_int_0));
    values[2] = ((PyObject *)((PyObject *)__pyx_int_1000));
    values[3] = ((PyObject *)((PyObject *)__pyx_int_0));

    /* "cPyUSBTMC.pyx":380
 * 
 *     def read0(self,requestSize=0, io_timeout=1000
 *               , lock_timeout=0, flag=False, termChar='\x00'):             # <<<<<<<<<<<<<<
 *         """
 *         returns values as tuple of (data size, binary array data)
 */
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject*)__pyx_kp_s__5));
    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);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestSize);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_io_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lock_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termChar);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read0") < 0)) __PYX_ERR(0, 379, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_requestSize = values[1];
    __pyx_v_io_timeout = values[2];
    __pyx_v_lock_timeout = values[3];
    __pyx_v_flag = values[4];
    __pyx_v_termChar = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read0", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.read0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_24read0(__pyx_self, __pyx_v_self, __pyx_v_requestSize, __pyx_v_io_timeout, __pyx_v_lock_timeout, __pyx_v_flag, __pyx_v_termChar);

  /* "cPyUSBTMC.pyx":379
 *     readS=read
 * 
 *     def read0(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *               , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_24read0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_requestSize, PyObject *__pyx_v_io_timeout, CYTHON_UNUSED PyObject *__pyx_v_lock_timeout, PyObject *__pyx_v_flag, PyObject *__pyx_v_termChar) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_ndata = NULL;
  PyObject *__pyx_v_eom = NULL;
  PyObject *__pyx_v_rsize = NULL;
  PyObject *__pyx_v_resp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read0", 0);

  /* "cPyUSBTMC.pyx":384
 *         returns values as tuple of (data size, binary array data)
 *         """
 *         data=array.array('B') # null array             # <<<<<<<<<<<<<<
 *         ndata=0
 *         eom=False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_B) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_B);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":385
 *         """
 *         data=array.array('B') # null array
 *         ndata=0             # <<<<<<<<<<<<<<
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_ndata = __pyx_int_0;

  /* "cPyUSBTMC.pyx":386
 *         data=array.array('B') # null array
 *         ndata=0
 *         eom=False             # <<<<<<<<<<<<<<
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 *             rsize=requestSize
 */
  __Pyx_INCREF(Py_False);
  __pyx_v_eom = Py_False;

  /* "cPyUSBTMC.pyx":387
 *         ndata=0
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:             # <<<<<<<<<<<<<<
 *             rsize=requestSize
 *         else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_requestSize, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_requestSize, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":388
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:
 *             rsize=requestSize             # <<<<<<<<<<<<<<
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER
 */
    __Pyx_INCREF(__pyx_v_requestSize);
    __pyx_v_rsize = __pyx_v_requestSize;

    /* "cPyUSBTMC.pyx":387
 *         ndata=0
 *         eom=False
 *         if 0 < requestSize < USBTMC_SIZE_IOBUFFER:             # <<<<<<<<<<<<<<
 *             rsize=requestSize
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":390
 *             rsize=requestSize
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER             # <<<<<<<<<<<<<<
 *         while not (eom or ((0 < requestSize) and (requestSize <= ndata))):
 *             resp=self.device_read(rsize, termCharFlag=flag,
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rsize = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":391
 *         else:
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         while not (eom or ((0 < requestSize) and (requestSize <= ndata))):             # <<<<<<<<<<<<<<
 *             resp=self.device_read(rsize, termCharFlag=flag,
 *                                   termchar=termChar,timeout=io_timeout)
 */
  while (1) {
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_eom); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_requestSize, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_requestSize, __pyx_v_ndata, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (!__pyx_t_5) break;

    /* "cPyUSBTMC.pyx":392
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         while not (eom or ((0 < requestSize) and (requestSize <= ndata))):
 *             resp=self.device_read(rsize, termCharFlag=flag,             # <<<<<<<<<<<<<<
 *                                   termchar=termChar,timeout=io_timeout)
 *             ndata += resp.TransferSize
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_rsize);
    __Pyx_GIVEREF(__pyx_v_rsize);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rsize);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termCharFlag, __pyx_v_flag) < 0) __PYX_ERR(0, 392, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":393
 *         while not (eom or ((0 < requestSize) and (requestSize <= ndata))):
 *             resp=self.device_read(rsize, termCharFlag=flag,
 *                                   termchar=termChar,timeout=io_timeout)             # <<<<<<<<<<<<<<
 *             ndata += resp.TransferSize
 *             #data  += resp.data
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termchar, __pyx_v_termChar) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_v_io_timeout) < 0) __PYX_ERR(0, 392, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":392
 *             rsize=USBTMC_SIZE_IOBUFFER
 *         while not (eom or ((0 < requestSize) and (requestSize <= ndata))):
 *             resp=self.device_read(rsize, termCharFlag=flag,             # <<<<<<<<<<<<<<
 *                                   termchar=termChar,timeout=io_timeout)
 *             ndata += resp.TransferSize
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_resp, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cPyUSBTMC.pyx":394
 *             resp=self.device_read(rsize, termCharFlag=flag,
 *                                   termchar=termChar,timeout=io_timeout)
 *             ndata += resp.TransferSize             # <<<<<<<<<<<<<<
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_TransferSize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_ndata, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_ndata, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":396
 *             ndata += resp.TransferSize
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])             # <<<<<<<<<<<<<<
 *             eom = resp.eom
 *             if eom:
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_TransferSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":397
 *             #data  += resp.data
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom             # <<<<<<<<<<<<<<
 *             if eom:
 *                 break
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_eom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_eom, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":398
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom
 *             if eom:             # <<<<<<<<<<<<<<
 *                 break
 *         return (ndata,data)
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_eom); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 398, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "cPyUSBTMC.pyx":399
 *             eom = resp.eom
 *             if eom:
 *                 break             # <<<<<<<<<<<<<<
 *         return (ndata,data)
 * 
 */
      goto __pyx_L5_break;

      /* "cPyUSBTMC.pyx":398
 *             data.extend(resp.data[:resp.TransferSize])
 *             eom = resp.eom
 *             if eom:             # <<<<<<<<<<<<<<
 *                 break
 *         return (ndata,data)
 */
    }
  }
  __pyx_L5_break:;

  /* "cPyUSBTMC.pyx":400
 *             if eom:
 *                 break
 *         return (ndata,data)             # <<<<<<<<<<<<<<
 * 
 *     def write(self, cmd="*IDN?\n"):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_ndata);
  __Pyx_GIVEREF(__pyx_v_ndata);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ndata);
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_data);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":379
 *     readS=read
 * 
 *     def read0(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *               , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.read0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_ndata);
  __Pyx_XDECREF(__pyx_v_eom);
  __Pyx_XDECREF(__pyx_v_rsize);
  __Pyx_XDECREF(__pyx_v_resp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":402
 *         return (ndata,data)
 * 
 *     def write(self, cmd="*IDN?\n"):             # <<<<<<<<<<<<<<
 *         return self.device_write(cmd)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_27write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_27write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_27write, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_27write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cmd = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cmd,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_IDN));
    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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmd);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 402, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_cmd = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 402, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_26write(__pyx_self, __pyx_v_self, __pyx_v_cmd);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_26write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cmd) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "cPyUSBTMC.pyx":403
 * 
 *     def write(self, cmd="*IDN?\n"):
 *         return self.device_write(cmd)             # <<<<<<<<<<<<<<
 * 
 *     def device_write(self,  message):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_cmd) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cmd);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __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;

  /* "cPyUSBTMC.pyx":402
 *         return (ndata,data)
 * 
 *     def write(self, cmd="*IDN?\n"):             # <<<<<<<<<<<<<<
 *         return self.device_write(cmd)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":405
 *         return self.device_write(cmd)
 * 
 *     def device_write(self,  message):             # <<<<<<<<<<<<<<
 *         remaining=len(message)
 *         while (remaining > 0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_29device_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_29device_write = {"device_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_29device_write, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_29device_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("device_write (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("device_write", 1, 2, 2, 1); __PYX_ERR(0, 405, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "device_write") < 0)) __PYX_ERR(0, 405, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("device_write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 405, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_28device_write(__pyx_self, __pyx_v_self, __pyx_v_message);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_28device_write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_v_remaining = NULL;
  int __pyx_v_eom;
  PyObject *__pyx_v_transferSize = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_command = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("device_write", 0);
  __Pyx_INCREF(__pyx_v_message);

  /* "cPyUSBTMC.pyx":406
 * 
 *     def device_write(self,  message):
 *         remaining=len(message)             # <<<<<<<<<<<<<<
 *         while (remaining > 0):
 *             #transferSize=remaining
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_message); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 406, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_remaining = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":407
 *     def device_write(self,  message):
 *         remaining=len(message)
 *         while (remaining > 0):             # <<<<<<<<<<<<<<
 *             #transferSize=remaining
 *             # bulk_out message includes 12bytes usbtmc header.
 */
  while (1) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_remaining, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 407, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_3) break;

    /* "cPyUSBTMC.pyx":410
 *             #transferSize=remaining
 *             # bulk_out message includes 12bytes usbtmc header.
 *             if ((remaining + 12 ) < USBTMC_SIZE_IOBUFFER):# do we need it in python?             # <<<<<<<<<<<<<<
 *                 eom=True
 *                 transferSize=remaining # can send all remaining data
 */
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_remaining, __pyx_int_12, 12, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {

      /* "cPyUSBTMC.pyx":411
 *             # bulk_out message includes 12bytes usbtmc header.
 *             if ((remaining + 12 ) < USBTMC_SIZE_IOBUFFER):# do we need it in python?
 *                 eom=True             # <<<<<<<<<<<<<<
 *                 transferSize=remaining # can send all remaining data
 *             else:
 */
      __pyx_v_eom = 1;

      /* "cPyUSBTMC.pyx":412
 *             if ((remaining + 12 ) < USBTMC_SIZE_IOBUFFER):# do we need it in python?
 *                 eom=True
 *                 transferSize=remaining # can send all remaining data             # <<<<<<<<<<<<<<
 *             else:
 *                 eom=False
 */
      __Pyx_INCREF(__pyx_v_remaining);
      __Pyx_XDECREF_SET(__pyx_v_transferSize, __pyx_v_remaining);

      /* "cPyUSBTMC.pyx":410
 *             #transferSize=remaining
 *             # bulk_out message includes 12bytes usbtmc header.
 *             if ((remaining + 12 ) < USBTMC_SIZE_IOBUFFER):# do we need it in python?             # <<<<<<<<<<<<<<
 *                 eom=True
 *                 transferSize=remaining # can send all remaining data
 */
      goto __pyx_L5;
    }

    /* "cPyUSBTMC.pyx":414
 *                 transferSize=remaining # can send all remaining data
 *             else:
 *                 eom=False             # <<<<<<<<<<<<<<
 *                 transferSize=USBTMC_SIZE_IOBUFFER-12 # send data as much as possible
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)
 */
    /*else*/ {
      __pyx_v_eom = 0;

      /* "cPyUSBTMC.pyx":415
 *             else:
 *                 eom=False
 *                 transferSize=USBTMC_SIZE_IOBUFFER-12 # send data as much as possible             # <<<<<<<<<<<<<<
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)
 *             if ((transferSize % 4) == 0):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_12, 12, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_transferSize, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L5:;

    /* "cPyUSBTMC.pyx":416
 *                 eom=False
 *                 transferSize=USBTMC_SIZE_IOBUFFER-12 # send data as much as possible
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)             # <<<<<<<<<<<<<<
 *             if ((transferSize % 4) == 0):
 *                 command="%s%s"%(h,message[:transferSize])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_mkDevDepMSGOUTHeader); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_transferSize);
    __Pyx_GIVEREF(__pyx_v_transferSize);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_transferSize);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_eom); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_eom, __pyx_t_6) < 0) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 416, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(0, 416, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 416, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":417
 *                 transferSize=USBTMC_SIZE_IOBUFFER-12 # send data as much as possible
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)
 *             if ((transferSize % 4) == 0):             # <<<<<<<<<<<<<<
 *                 command="%s%s"%(h,message[:transferSize])
 *             else:# padding data for 4bytes boundary
 */
    __pyx_t_6 = __Pyx_PyInt_RemainderObjC(__pyx_v_transferSize, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {

      /* "cPyUSBTMC.pyx":418
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)
 *             if ((transferSize % 4) == 0):
 *                 command="%s%s"%(h,message[:transferSize])             # <<<<<<<<<<<<<<
 *             else:# padding data for 4bytes boundary
 *                 command="%s%s%s"%(h,message[:transferSize],(4-(transferSize % 4))*'\0')
 */
      __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_message, 0, 0, NULL, &__pyx_v_transferSize, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_h);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_command, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "cPyUSBTMC.pyx":417
 *                 transferSize=USBTMC_SIZE_IOBUFFER-12 # send data as much as possible
 *             t,h=mkDevDepMSGOUTHeader(transferSize, eom=eom)
 *             if ((transferSize % 4) == 0):             # <<<<<<<<<<<<<<
 *                 command="%s%s"%(h,message[:transferSize])
 *             else:# padding data for 4bytes boundary
 */
      goto __pyx_L8;
    }

    /* "cPyUSBTMC.pyx":420
 *                 command="%s%s"%(h,message[:transferSize])
 *             else:# padding data for 4bytes boundary
 *                 command="%s%s%s"%(h,message[:transferSize],(4-(transferSize % 4))*'\0')             # <<<<<<<<<<<<<<
 *             command=array.array('B',command)
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_message, 0, 0, NULL, &__pyx_v_transferSize, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyInt_RemainderObjC(__pyx_v_transferSize, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_4, __pyx_t_6, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_kp_s__5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_h);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_s_s, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_command, __pyx_t_6);
      __pyx_t_6 = 0;
    }
    __pyx_L8:;

    /* "cPyUSBTMC.pyx":421
 *             else:# padding data for 4bytes boundary
 *                 command="%s%s%s"%(h,message[:transferSize],(4-(transferSize % 4))*'\0')
 *             command=array.array('B',command)             # <<<<<<<<<<<<<<
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 *             try:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_B, __pyx_v_command};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_B, __pyx_v_command};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_s_B);
      __Pyx_GIVEREF(__pyx_n_s_B);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_n_s_B);
      __Pyx_INCREF(__pyx_v_command);
      __Pyx_GIVEREF(__pyx_v_command);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_v_command);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_command, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cPyUSBTMC.pyx":423
 *             command=array.array('B',command)
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(command)
 *                 self.last_write_bTag=t
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "cPyUSBTMC.pyx":424
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 *             try:
 *                 self.bulk_out.write(command)             # <<<<<<<<<<<<<<
 *                 self.last_write_bTag=t
 *             except:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 424, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_command) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_command);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cPyUSBTMC.pyx":425
 *             try:
 *                 self.bulk_out.write(command)
 *                 self.last_write_bTag=t             # <<<<<<<<<<<<<<
 *             except:
 *                 #self.abort_bulk_out() # is it reasonable?
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_write_bTag, __pyx_v_t) < 0) __PYX_ERR(0, 425, __pyx_L9_error)

        /* "cPyUSBTMC.pyx":423
 *             command=array.array('B',command)
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(command)
 *                 self.last_write_bTag=t
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L16_try_end;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cPyUSBTMC.pyx":426
 *                 self.bulk_out.write(command)
 *                 self.last_write_bTag=t
 *             except:             # <<<<<<<<<<<<<<
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")
 */
      /*except:*/ {
        __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 426, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);

        /* "cPyUSBTMC.pyx":428
 *             except:
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")             # <<<<<<<<<<<<<<
 *                 raise
 *             message=message[transferSize:]
 */
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 428, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_stdout); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 428, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_write); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 428, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_n_s_aborting) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_n_s_aborting);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 428, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cPyUSBTMC.pyx":429
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")
 *                 raise             # <<<<<<<<<<<<<<
 *             message=message[transferSize:]
 *             remaining=len(message)
 */
        __Pyx_GIVEREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_4, __pyx_t_5);
        __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; 
        __PYX_ERR(0, 429, __pyx_L11_except_error)
      }
      __pyx_L11_except_error:;

      /* "cPyUSBTMC.pyx":423
 *             command=array.array('B',command)
 *             #print "device_write:",t,command,command.tostring(),len(command),transferSize
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(command)
 *                 self.last_write_bTag=t
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L16_try_end:;
    }

    /* "cPyUSBTMC.pyx":430
 *                 sys.stdout.write("aborting\n")
 *                 raise
 *             message=message[transferSize:]             # <<<<<<<<<<<<<<
 *             remaining=len(message)
 *         return
 */
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_message, 0, 0, &__pyx_v_transferSize, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":431
 *                 raise
 *             message=message[transferSize:]
 *             remaining=len(message)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __pyx_t_1 = PyObject_Length(__pyx_v_message); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 431, __pyx_L1_error)
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_remaining, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "cPyUSBTMC.pyx":432
 *             message=message[transferSize:]
 *             remaining=len(message)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":405
 *         return self.device_write(cmd)
 * 
 *     def device_write(self,  message):             # <<<<<<<<<<<<<<
 *         remaining=len(message)
 *         while (remaining > 0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_remaining);
  __Pyx_XDECREF(__pyx_v_transferSize);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_command);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":434
 *         return
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,             # <<<<<<<<<<<<<<
 *                     termCharFlag=False,
 *                     termchar="\0", timeout=1000):
 */

static PyObject *__pyx_pf_9cPyUSBTMC_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);

  /* "cPyUSBTMC.pyx":435
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,
 *                     termCharFlag=False,             # <<<<<<<<<<<<<<
 *                     termchar="\0", timeout=1000):
 *         # bulkin header size = 12 standard headr
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_transferSize);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_transferSize);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_transferSize);
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_False));
  __Pyx_INCREF(((PyObject*)__pyx_kp_s__5));
  __Pyx_GIVEREF(((PyObject*)__pyx_kp_s__5));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject*)__pyx_kp_s__5));
  __Pyx_INCREF(((PyObject *)__pyx_int_1000));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_1000));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_int_1000));

  /* "cPyUSBTMC.pyx":434
 *         return
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,             # <<<<<<<<<<<<<<
 *                     termCharFlag=False,
 *                     termchar="\0", timeout=1000):
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_31device_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_31device_read = {"device_read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_31device_read, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_31device_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_transferSize = 0;
  PyObject *__pyx_v_termCharFlag = 0;
  PyObject *__pyx_v_termchar = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("device_read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_transferSize,&__pyx_n_s_termCharFlag,&__pyx_n_s_termchar,&__pyx_n_s_timeout,0};
    PyObject* values[5] = {0,0,0,0,0};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[1] = __pyx_dynamic_args->__pyx_arg_transferSize;
    values[2] = ((PyObject *)((PyObject *)Py_False));
    values[3] = ((PyObject *)((PyObject*)__pyx_kp_s__5));
    values[4] = ((PyObject *)((PyObject *)__pyx_int_1000));
    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);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transferSize);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termCharFlag);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termchar);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "device_read") < 0)) __PYX_ERR(0, 434, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_transferSize = values[1];
    __pyx_v_termCharFlag = values[2];
    __pyx_v_termchar = values[3];
    __pyx_v_timeout = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("device_read", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 434, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_30device_read(__pyx_self, __pyx_v_self, __pyx_v_transferSize, __pyx_v_termCharFlag, __pyx_v_termchar, __pyx_v_timeout);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_30device_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transferSize, PyObject *__pyx_v_termCharFlag, PyObject *__pyx_v_termchar, PyObject *__pyx_v_timeout) {
  CYTHON_UNUSED long __pyx_v_ndata;
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_buf = NULL;
  PyObject *__pyx_v_raw_resp = NULL;
  PyObject *__pyx_v_resp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("device_read", 0);

  /* "cPyUSBTMC.pyx":439
 *         # bulkin header size = 12 standard headr
 *         #                    + 4bytes for Deivce Responce (msgID, TransferSize, termChar, eom)
 *         ndata=0             # <<<<<<<<<<<<<<
 *         btag,buf=mkReqDevDepMSGINHeader(transferSize, termCharFlag, termchar)
 *         buf=array.array('B',buf) # convert string to byte array
 */
  __pyx_v_ndata = 0;

  /* "cPyUSBTMC.pyx":440
 *         #                    + 4bytes for Deivce Responce (msgID, TransferSize, termChar, eom)
 *         ndata=0
 *         btag,buf=mkReqDevDepMSGINHeader(transferSize, termCharFlag, termchar)             # <<<<<<<<<<<<<<
 *         buf=array.array('B',buf) # convert string to byte array
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkReqDevDepMSGINHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && 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);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_transferSize, __pyx_v_termCharFlag, __pyx_v_termchar};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_transferSize, __pyx_v_termCharFlag, __pyx_v_termchar};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_transferSize);
    __Pyx_GIVEREF(__pyx_v_transferSize);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_transferSize);
    __Pyx_INCREF(__pyx_v_termCharFlag);
    __Pyx_GIVEREF(__pyx_v_termCharFlag);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_termCharFlag);
    __Pyx_INCREF(__pyx_v_termchar);
    __Pyx_GIVEREF(__pyx_v_termchar);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_termchar);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 440, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 440, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 440, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_buf = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":441
 *         ndata=0
 *         btag,buf=mkReqDevDepMSGINHeader(transferSize, termCharFlag, termchar)
 *         buf=array.array('B',buf) # convert string to byte array             # <<<<<<<<<<<<<<
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 *         try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_B, __pyx_v_buf};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_B, __pyx_v_buf};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_B);
    __Pyx_GIVEREF(__pyx_n_s_B);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_n_s_B);
    __Pyx_INCREF(__pyx_v_buf);
    __Pyx_GIVEREF(__pyx_v_buf);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_buf);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_buf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":443
 *         buf=array.array('B',buf) # convert string to byte array
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 *         try:             # <<<<<<<<<<<<<<
 *             self.bulk_out.write(buf, timeout=self.timeout)
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "cPyUSBTMC.pyx":444
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 *         try:
 *             self.bulk_out.write(buf, timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         except:
 *             #self.abort_bulk_out() #?
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_buf);
      __Pyx_GIVEREF(__pyx_v_buf);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buf);
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_t_5) < 0) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cPyUSBTMC.pyx":443
 *         buf=array.array('B',buf) # convert string to byte array
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 *         try:             # <<<<<<<<<<<<<<
 *             self.bulk_out.write(buf, timeout=self.timeout)
 *         except:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":445
 *         try:
 *             self.bulk_out.write(buf, timeout=self.timeout)
 *         except:             # <<<<<<<<<<<<<<
 *             #self.abort_bulk_out() #?
 *             sys.stdout.write("aborting\n")
 */
    /*except:*/ {
      __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 445, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);

      /* "cPyUSBTMC.pyx":447
 *         except:
 *             #self.abort_bulk_out() #?
 *             sys.stdout.write("aborting\n")             # <<<<<<<<<<<<<<
 *             raise
 *         self.last_write_bTag=btag
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_sys); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 447, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_stdout); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 447, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 447, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_n_s_aborting) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_n_s_aborting);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":448
 *             #self.abort_bulk_out() #?
 *             sys.stdout.write("aborting\n")
 *             raise             # <<<<<<<<<<<<<<
 *         self.last_write_bTag=btag
 *         try:
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_3, __pyx_t_1);
      __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; 
      __PYX_ERR(0, 448, __pyx_L7_except_error)
    }
    __pyx_L7_except_error:;

    /* "cPyUSBTMC.pyx":443
 *         buf=array.array('B',buf) # convert string to byte array
 *         #print "ReqHeader:",buf,len(buf),'transferSize:',transferSize
 *         try:             # <<<<<<<<<<<<<<
 *             self.bulk_out.write(buf, timeout=self.timeout)
 *         except:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "cPyUSBTMC.pyx":449
 *             sys.stdout.write("aborting\n")
 *             raise
 *         self.last_write_bTag=btag             # <<<<<<<<<<<<<<
 *         try:
 *             # add 12+4 for usb header size (NY, 2015.1.21)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_write_bTag, __pyx_v_btag) < 0) __PYX_ERR(0, 449, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":450
 *             raise
 *         self.last_write_bTag=btag
 *         try:             # <<<<<<<<<<<<<<
 *             # add 12+4 for usb header size (NY, 2015.1.21)
 *             raw_resp=self.bulk_in.read(transferSize+16, timeout = timeout)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "cPyUSBTMC.pyx":452
 *         try:
 *             # add 12+4 for usb header size (NY, 2015.1.21)
 *             raw_resp=self.bulk_in.read(transferSize+16, timeout = timeout)             # <<<<<<<<<<<<<<
 *             #print raw_resp
 *             resp=DevDep_Responce(raw_resp)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_transferSize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(0, 452, __pyx_L13_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_raw_resp = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":454
 *             raw_resp=self.bulk_in.read(transferSize+16, timeout = timeout)
 *             #print raw_resp
 *             resp=DevDep_Responce(raw_resp)             # <<<<<<<<<<<<<<
 *         except:
 *             raise
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DevDep_Responce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_raw_resp) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_raw_resp);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_resp = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":450
 *             raise
 *         self.last_write_bTag=btag
 *         try:             # <<<<<<<<<<<<<<
 *             # add 12+4 for usb header size (NY, 2015.1.21)
 *             raw_resp=self.bulk_in.read(transferSize+16, timeout = timeout)
 */
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L18_try_end;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":455
 *             #print raw_resp
 *             resp=DevDep_Responce(raw_resp)
 *         except:             # <<<<<<<<<<<<<<
 *             raise
 *         self.last_read_bTag=resp.bTag
 */
    /*except:*/ {
      __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 455, __pyx_L15_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);

      /* "cPyUSBTMC.pyx":456
 *             resp=DevDep_Responce(raw_resp)
 *         except:
 *             raise             # <<<<<<<<<<<<<<
 *         self.last_read_bTag=resp.bTag
 *         return resp
 */
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_5);
      __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; 
      __PYX_ERR(0, 456, __pyx_L15_except_error)
    }
    __pyx_L15_except_error:;

    /* "cPyUSBTMC.pyx":450
 *             raise
 *         self.last_write_bTag=btag
 *         try:             # <<<<<<<<<<<<<<
 *             # add 12+4 for usb header size (NY, 2015.1.21)
 *             raw_resp=self.bulk_in.read(transferSize+16, timeout = timeout)
 */
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L18_try_end:;
  }

  /* "cPyUSBTMC.pyx":457
 *         except:
 *             raise
 *         self.last_read_bTag=resp.bTag             # <<<<<<<<<<<<<<
 *         return resp
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_resp, __pyx_n_s_bTag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_read_bTag, __pyx_t_5) < 0) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":458
 *             raise
 *         self.last_read_bTag=resp.bTag
 *         return resp             # <<<<<<<<<<<<<<
 * 
 *     def vender_write(self,message):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_resp);
  __pyx_r = __pyx_v_resp;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":434
 *         return
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,             # <<<<<<<<<<<<<<
 *                     termCharFlag=False,
 *                     termchar="\0", timeout=1000):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.device_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_raw_resp);
  __Pyx_XDECREF(__pyx_v_resp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":460
 *         return resp
 * 
 *     def vender_write(self,message):             # <<<<<<<<<<<<<<
 *         """
 *         Vender specific bulk write method. Should be
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_33vender_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USBTMC_device_32vender_write[] = "\n        Vender specific bulk write method. Should be \n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_33vender_write = {"vender_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_33vender_write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cPyUSBTMC_13USBTMC_device_32vender_write};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_33vender_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_message = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vender_write (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("vender_write", 1, 2, 2, 1); __PYX_ERR(0, 460, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vender_write") < 0)) __PYX_ERR(0, 460, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vender_write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 460, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.vender_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_32vender_write(__pyx_self, __pyx_v_self, __pyx_v_message);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_32vender_write(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_message) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("vender_write", 0);

  /* "cPyUSBTMC.pyx":464
 *         Vender specific bulk write method. Should be
 *         """
 *         raise USBTMCError("Not Implemented")             # <<<<<<<<<<<<<<
 * 
 *     def vender_read(self,maxsize=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_Not_Implemented) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Not_Implemented);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 464, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":460
 *         return resp
 * 
 *     def vender_write(self,message):             # <<<<<<<<<<<<<<
 *         """
 *         Vender specific bulk write method. Should be
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.vender_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":466
 *         raise USBTMCError("Not Implemented")
 * 
 *     def vender_read(self,maxsize=None):             # <<<<<<<<<<<<<<
 *         raise USBTMCError("Not Implemented")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_35vender_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_35vender_read = {"vender_read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USBTMC_device_35vender_read, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_35vender_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_maxsize = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vender_read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_maxsize,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vender_read") < 0)) __PYX_ERR(0, 466, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_maxsize = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vender_read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 466, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.vender_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_34vender_read(__pyx_self, __pyx_v_self, __pyx_v_maxsize);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_34vender_read(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_maxsize) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("vender_read", 0);

  /* "cPyUSBTMC.pyx":467
 * 
 *     def vender_read(self,maxsize=None):
 *         raise USBTMCError("Not Implemented")             # <<<<<<<<<<<<<<
 * 
 *     def check_SRQ(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_Not_Implemented) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Not_Implemented);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 467, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":466
 *         raise USBTMCError("Not Implemented")
 * 
 *     def vender_read(self,maxsize=None):             # <<<<<<<<<<<<<<
 *         raise USBTMCError("Not Implemented")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.vender_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":469
 *         raise USBTMCError("Not Implemented")
 * 
 *     def check_SRQ(self):             # <<<<<<<<<<<<<<
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)
 *         sb=Interrupt_IN_Data(rv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_37check_SRQ(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_37check_SRQ = {"check_SRQ", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_37check_SRQ, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_37check_SRQ(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_SRQ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_36check_SRQ(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_36check_SRQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_sb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_SRQ", 0);

  /* "cPyUSBTMC.pyx":470
 * 
 *     def check_SRQ(self):
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)             # <<<<<<<<<<<<<<
 *         sb=Interrupt_IN_Data(rv)
 *         # assert(sb.bTag == 0x1) for SRQ
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_wMaxPacketSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_bInterval); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_t_5) < 0) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":471
 *     def check_SRQ(self):
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)
 *         sb=Interrupt_IN_Data(rv)             # <<<<<<<<<<<<<<
 *         # assert(sb.bTag == 0x1) for SRQ
 *         return sb
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Interrupt_IN_Data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_rv) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_rv);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sb = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":473
 *         sb=Interrupt_IN_Data(rv)
 *         # assert(sb.bTag == 0x1) for SRQ
 *         return sb             # <<<<<<<<<<<<<<
 * 
 *     # class standard control messages
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sb);
  __pyx_r = __pyx_v_sb;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":469
 *         raise USBTMCError("Not Implemented")
 * 
 *     def check_SRQ(self):             # <<<<<<<<<<<<<<
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)
 *         sb=Interrupt_IN_Data(rv)
 */

  /* 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("cPyUSBTMC.USBTMC_device.check_SRQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_sb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":498
 *     value is the data payload read, as an array object."""
 * 
 *     def abort_bulk_out(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_39abort_bulk_out(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_39abort_bulk_out = {"abort_bulk_out", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_39abort_bulk_out, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_39abort_bulk_out(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abort_bulk_out (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_38abort_bulk_out(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_38abort_bulk_out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("abort_bulk_out", 0);

  /* "cPyUSBTMC.pyx":499
 * 
 *     def abort_bulk_out(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             usb.util.build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":500
 *     def abort_bulk_out(self):
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type             # <<<<<<<<<<<<<<
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 *                 #usb.ENDPOINT_IN | usb.TYPE_CLASS|usb.RECIP_ENDPOINT,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_usb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":501
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT             # <<<<<<<<<<<<<<
 *                 #usb.ENDPOINT_IN | usb.TYPE_CLASS|usb.RECIP_ENDPOINT,
 *             ),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":504
 *                 #usb.ENDPOINT_IN | usb.TYPE_CLASS|usb.RECIP_ENDPOINT,
 *             ),
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_OUT,             # <<<<<<<<<<<<<<
 *             self.last_write_bTag,
 *             self.bulk_out.bEndpointAddress,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_INITIATE_ABORT_BULK_OUT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":505
 *             ),
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_OUT,
 *             self.last_write_bTag,             # <<<<<<<<<<<<<<
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=2,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_last_write_bTag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":506
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_OUT,
 *             self.last_write_bTag,
 *             self.bulk_out.bEndpointAddress,             # <<<<<<<<<<<<<<
 *             data_or_wLength=2,
 *             timeout=self.timeout)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":499
 * 
 *     def abort_bulk_out(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             usb.util.build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 */
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":507
 *             self.last_write_bTag,
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=2,             # <<<<<<<<<<<<<<
 *             timeout=self.timeout)
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_data_or_wLength, __pyx_int_2) < 0) __PYX_ERR(0, 507, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":508
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=2,
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_out_status()
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_timeout, __pyx_t_3) < 0) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":499
 * 
 *     def abort_bulk_out(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             usb.util.build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":509
 *             data_or_wLength=2,
 *             timeout=self.timeout)
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_abort_bulk_out_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_10) {

    /* "cPyUSBTMC.pyx":510
 *             timeout=self.timeout)
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_out_status()             # <<<<<<<<<<<<<<
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_out_status()
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_abort_bulk_out_status); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":511
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_out_status()
 *             while(rv[0] == USBTMC_Status.PENDING):             # <<<<<<<<<<<<<<
 *                 rv=self.check_abort_bulk_out_status()
 *             if (rv[0] == USBTMC_Status.SUCCESS):
 */
    while (1) {
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_PENDING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_10) break;

      /* "cPyUSBTMC.pyx":512
 *             rv=self.check_abort_bulk_out_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_out_status()             # <<<<<<<<<<<<<<
 *             if (rv[0] == USBTMC_Status.SUCCESS):
 *                 self.clear_bulk_out_halt()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_abort_bulk_out_status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "cPyUSBTMC.pyx":513
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_out_status()
 *             if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *                 self.clear_bulk_out_halt()
 *             return rv
 */
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {

      /* "cPyUSBTMC.pyx":514
 *                 rv=self.check_abort_bulk_out_status()
 *             if (rv[0] == USBTMC_Status.SUCCESS):
 *                 self.clear_bulk_out_halt()             # <<<<<<<<<<<<<<
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clear_bulk_out_halt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":513
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_out_status()
 *             if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *                 self.clear_bulk_out_halt()
 *             return rv
 */
    }

    /* "cPyUSBTMC.pyx":515
 *             if (rv[0] == USBTMC_Status.SUCCESS):
 *                 self.clear_bulk_out_halt()
 *             return rv             # <<<<<<<<<<<<<<
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *                 raise USBTMCError("Transfer not in progress")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_rv);
    __pyx_r = __pyx_v_rv;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":509
 *             data_or_wLength=2,
 *             timeout=self.timeout)
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_abort_bulk_out_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 */
  }

  /* "cPyUSBTMC.pyx":516
 *                 self.clear_bulk_out_halt()
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *                 raise USBTMCError("Transfer not in progress")
 *         else:
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_TRANSFER_NOT_IN_PROGRESS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_t_10)) {

    /* "cPyUSBTMC.pyx":517
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *                 raise USBTMCError("Transfer not in progress")             # <<<<<<<<<<<<<<
 *         else:
 *             print "Abort_bulk_out Error",rv
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_kp_s_Transfer_not_in_progress) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Transfer_not_in_progress);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 517, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":516
 *                 self.clear_bulk_out_halt()
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *                 raise USBTMCError("Transfer not in progress")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":519
 *                 raise USBTMCError("Transfer not in progress")
 *         else:
 *             print "Abort_bulk_out Error",rv             # <<<<<<<<<<<<<<
 *             raise USBTMCError("Initiate abort_bulk_out failed")
 * 
 */
  /*else*/ {
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_s_Abort_bulk_out_Error);
    __Pyx_GIVEREF(__pyx_kp_s_Abort_bulk_out_Error);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_s_Abort_bulk_out_Error);
    __Pyx_INCREF(__pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rv);
    if (__Pyx_Print(0, __pyx_t_5, 1) < 0) __PYX_ERR(0, 519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":520
 *         else:
 *             print "Abort_bulk_out Error",rv
 *             raise USBTMCError("Initiate abort_bulk_out failed")             # <<<<<<<<<<<<<<
 * 
 *     def check_abort_bulk_out_status(self):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_kp_s_Initiate_abort_bulk_out_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Initiate_abort_bulk_out_failed);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 520, __pyx_L1_error)
  }

  /* "cPyUSBTMC.pyx":498
 *     value is the data payload read, as an array object."""
 * 
 *     def abort_bulk_out(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.abort_bulk_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":522
 *             raise USBTMCError("Initiate abort_bulk_out failed")
 * 
 *     def check_abort_bulk_out_status(self):             # <<<<<<<<<<<<<<
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_41check_abort_bulk_out_status(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_41check_abort_bulk_out_status = {"check_abort_bulk_out_status", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_41check_abort_bulk_out_status, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_41check_abort_bulk_out_status(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_abort_bulk_out_status (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_40check_abort_bulk_out_status(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_40check_abort_bulk_out_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_abort_bulk_out_status", 0);

  /* "cPyUSBTMC.pyx":524
 *     def check_abort_bulk_out_status(self):
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT),
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":525
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT),             # <<<<<<<<<<<<<<
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS
 *             0,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":526
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT),
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS             # <<<<<<<<<<<<<<
 *             0,
 *             self.bulk_out.bEndpointAddress,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_CHECK_ABORT_BULK_OUT_STATUS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":528
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS
 *             0,
 *             self.bulk_out.bEndpointAddress,             # <<<<<<<<<<<<<<
 *             data_or_wLength=8,
 *             timeout=self.timeout)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":524
 *     def check_abort_bulk_out_status(self):
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT),
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS
 */
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":529
 *             0,
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=8,             # <<<<<<<<<<<<<<
 *             timeout=self.timeout)
 *         return rv
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data_or_wLength, __pyx_int_8) < 0) __PYX_ERR(0, 529, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":530
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=8,
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_timeout, __pyx_t_9) < 0) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":524
 *     def check_abort_bulk_out_status(self):
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT),
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_OUT_STATUS, # CHECK_STATUS
 */
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_rv = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":531
 *             data_or_wLength=8,
 *             timeout=self.timeout)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":522
 *             raise USBTMCError("Initiate abort_bulk_out failed")
 * 
 *     def check_abort_bulk_out_status(self):             # <<<<<<<<<<<<<<
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.check_abort_bulk_out_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":533
 *         return rv
 * 
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4             # <<<<<<<<<<<<<<
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_43clear_bulk_out_halt(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_43clear_bulk_out_halt = {"clear_bulk_out_halt", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_43clear_bulk_out_halt, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_43clear_bulk_out_halt(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_bulk_out_halt (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_42clear_bulk_out_halt(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_42clear_bulk_out_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_bulk_out_halt", 0);

  /* "cPyUSBTMC.pyx":535
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":536
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),             # <<<<<<<<<<<<<<
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_OUT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_STANDARD); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":537
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request             # <<<<<<<<<<<<<<
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 *             self.bulk_out.bEndpointAddress,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_usb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_REQ_CLEAR_FEATURE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":538
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT             # <<<<<<<<<<<<<<
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=None,# Although we don't really want data this time
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_usbctrl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ENDPOINT_HALT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":539
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 *             self.bulk_out.bEndpointAddress,             # <<<<<<<<<<<<<<
 *             data_or_wLength=None,# Although we don't really want data this time
 *             timeout=self.timeout)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":535
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 */
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":540
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=None,# Although we don't really want data this time             # <<<<<<<<<<<<<<
 *             timeout=self.timeout)
 *         if(rv==None):
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_data_or_wLength, Py_None) < 0) __PYX_ERR(0, 540, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":541
 *             self.bulk_out.bEndpointAddress,
 *             data_or_wLength=None,# Although we don't really want data this time
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         if(rv==None):
 *             sys.stdout.write("USBTMC: usb_control_msg returned None\n")
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_timeout, __pyx_t_6) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":535
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD, CTRL_RECIPIENT_ENDPOINT),
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 */
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_rv = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":542
 *             data_or_wLength=None,# Although we don't really want data this time
 *             timeout=self.timeout)
 *         if(rv==None):             # <<<<<<<<<<<<<<
 *             sys.stdout.write("USBTMC: usb_control_msg returned None\n")
 * 
 */
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_rv, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 542, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_10) {

    /* "cPyUSBTMC.pyx":543
 *             timeout=self.timeout)
 *         if(rv==None):
 *             sys.stdout.write("USBTMC: usb_control_msg returned None\n")             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s_USBTMC_usb_control_msg_returned) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_USBTMC_usb_control_msg_returned);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cPyUSBTMC.pyx":542
 *             data_or_wLength=None,# Although we don't really want data this time
 *             timeout=self.timeout)
 *         if(rv==None):             # <<<<<<<<<<<<<<
 *             sys.stdout.write("USBTMC: usb_control_msg returned None\n")
 * 
 */
  }

  /* "cPyUSBTMC.pyx":545
 *             sys.stdout.write("USBTMC: usb_control_msg returned None\n")
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def abort_bulk_in(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":533
 *         return rv
 * 
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4             # <<<<<<<<<<<<<<
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.clear_bulk_out_halt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":547
 *         return rv
 * 
 *     def abort_bulk_in(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_45abort_bulk_in(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_45abort_bulk_in = {"abort_bulk_in", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_45abort_bulk_in, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_45abort_bulk_in(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abort_bulk_in (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_44abort_bulk_in(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_44abort_bulk_in(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("abort_bulk_in", 0);

  /* "cPyUSBTMC.pyx":548
 * 
 *     def abort_bulk_in(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":549
 *     def abort_bulk_in(self):
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type             # <<<<<<<<<<<<<<
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 *             ),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cPyUSBTMC.pyx":550
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT             # <<<<<<<<<<<<<<
 *             ),
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_IN, # INITIATE_ABORT
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":552
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_ENDPOINT
 *             ),
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_IN, # INITIATE_ABORT             # <<<<<<<<<<<<<<
 *             self.last_read_bTag, # Last transaction's bTag value
 *             self.bulk_in.bEndpointAddress, # Endpoint
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_INITIATE_ABORT_BULK_IN); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":553
 *             ),
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_IN, # INITIATE_ABORT
 *             self.last_read_bTag, # Last transaction's bTag value             # <<<<<<<<<<<<<<
 *             self.bulk_in.bEndpointAddress, # Endpoint
 *             2, # Number of characters to read
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_last_read_bTag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cPyUSBTMC.pyx":554
 *             USBTMC_REQUEST.INITIATE_ABORT_BULK_IN, # INITIATE_ABORT
 *             self.last_read_bTag, # Last transaction's bTag value
 *             self.bulk_in.bEndpointAddress, # Endpoint             # <<<<<<<<<<<<<<
 *             2, # Number of characters to read
 *             self.timeout); # Timeout in miliseconds
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cPyUSBTMC.pyx":556
 *             self.bulk_in.bEndpointAddress, # Endpoint
 *             2, # Number of characters to read
 *             self.timeout); # Timeout in miliseconds             # <<<<<<<<<<<<<<
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_in_status()
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_4, __pyx_t_6, __pyx_int_2, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_4, __pyx_t_6, __pyx_int_2, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_9, __pyx_t_6);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_9, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_9, __pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":557
 *             2, # Number of characters to read
 *             self.timeout); # Timeout in miliseconds
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_abort_bulk_in_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_11) {

    /* "cPyUSBTMC.pyx":558
 *             self.timeout); # Timeout in miliseconds
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_in_status()             # <<<<<<<<<<<<<<
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_int_status()
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_abort_bulk_in_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cPyUSBTMC.pyx":559
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_abort_bulk_in_status()
 *             while(rv[0] == USBTMC_Status.PENDING):             # <<<<<<<<<<<<<<
 *                 rv=self.check_abort_bulk_int_status()
 *             return rv
 */
    while (1) {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_PENDING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!__pyx_t_11) break;

      /* "cPyUSBTMC.pyx":560
 *             rv=self.check_abort_bulk_in_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_int_status()             # <<<<<<<<<<<<<<
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_abort_bulk_int_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && 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);
        }
      }
      __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_8);
      __pyx_t_8 = 0;
    }

    /* "cPyUSBTMC.pyx":561
 *             while(rv[0] == USBTMC_Status.PENDING):
 *                 rv=self.check_abort_bulk_int_status()
 *             return rv             # <<<<<<<<<<<<<<
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *             return
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_rv);
    __pyx_r = __pyx_v_rv;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":557
 *             2, # Number of characters to read
 *             self.timeout); # Timeout in miliseconds
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_abort_bulk_in_status()
 *             while(rv[0] == USBTMC_Status.PENDING):
 */
  }

  /* "cPyUSBTMC.pyx":562
 *                 rv=self.check_abort_bulk_int_status()
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return
 *         elif (rv[0] == USBTMC_Status.FAILED):
 */
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_TRANSFER_NOT_IN_PROGRESS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_11) {

    /* "cPyUSBTMC.pyx":563
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *             return             # <<<<<<<<<<<<<<
 *         elif (rv[0] == USBTMC_Status.FAILED):
 *             return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":562
 *                 rv=self.check_abort_bulk_int_status()
 *             return rv
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):             # <<<<<<<<<<<<<<
 *             return
 *         elif (rv[0] == USBTMC_Status.FAILED):
 */
  }

  /* "cPyUSBTMC.pyx":564
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *             return
 *         elif (rv[0] == USBTMC_Status.FAILED):             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_FAILED); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_11)) {

    /* "cPyUSBTMC.pyx":565
 *             return
 *         elif (rv[0] == USBTMC_Status.FAILED):
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":564
 *         elif (rv[0] == USBTMC_Status.TRANSFER_NOT_IN_PROGRESS):
 *             return
 *         elif (rv[0] == USBTMC_Status.FAILED):             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":567
 *             return
 *         else:
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])             # <<<<<<<<<<<<<<
 * 
 *     def check_abort_bulk_in_status(self):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Initiate_abort_bulk_in_failed_d, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 567, __pyx_L1_error)
  }

  /* "cPyUSBTMC.pyx":547
 *         return rv
 * 
 *     def abort_bulk_in(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.abort_bulk_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":569
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])
 * 
 *     def check_abort_bulk_in_status(self):             # <<<<<<<<<<<<<<
 *         n=0
 *         max_size=self.bulk_in.wMaxPacketSize
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_47check_abort_bulk_in_status(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_47check_abort_bulk_in_status = {"check_abort_bulk_in_status", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_47check_abort_bulk_in_status, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_47check_abort_bulk_in_status(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_abort_bulk_in_status (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_46check_abort_bulk_in_status(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_46check_abort_bulk_in_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_max_size = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_abort_bulk_in_status", 0);

  /* "cPyUSBTMC.pyx":570
 * 
 *     def check_abort_bulk_in_status(self):
 *         n=0             # <<<<<<<<<<<<<<
 *         max_size=self.bulk_in.wMaxPacketSize
 *         # clear buffer
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_n = __pyx_int_0;

  /* "cPyUSBTMC.pyx":571
 *     def check_abort_bulk_in_status(self):
 *         n=0
 *         max_size=self.bulk_in.wMaxPacketSize             # <<<<<<<<<<<<<<
 *         # clear buffer
 *         while(1):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_wMaxPacketSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_max_size = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":573
 *         max_size=self.bulk_in.wMaxPacketSize
 *         # clear buffer
 *         while(1):             # <<<<<<<<<<<<<<
 *             rv=self.bulk_in.read(USBTMC_SIZE_IOBUFFER, self.timeout)
 *             n +=1
 */
  while (1) {

    /* "cPyUSBTMC.pyx":574
 *         # clear buffer
 *         while(1):
 *             rv=self.bulk_in.read(USBTMC_SIZE_IOBUFFER, self.timeout)             # <<<<<<<<<<<<<<
 *             n +=1
 *             if (len(rv) < max_size): #receive a short packet.
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_SIZE_IOBUFFER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rv, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":575
 *         while(1):
 *             rv=self.bulk_in.read(USBTMC_SIZE_IOBUFFER, self.timeout)
 *             n +=1             # <<<<<<<<<<<<<<
 *             if (len(rv) < max_size): #receive a short packet.
 *                 break
 */
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":576
 *             rv=self.bulk_in.read(USBTMC_SIZE_IOBUFFER, self.timeout)
 *             n +=1
 *             if (len(rv) < max_size): #receive a short packet.             # <<<<<<<<<<<<<<
 *                 break
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):
 */
    __pyx_t_8 = PyObject_Length(__pyx_v_rv); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 576, __pyx_L1_error)
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_max_size, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "cPyUSBTMC.pyx":577
 *             n +=1
 *             if (len(rv) < max_size): #receive a short packet.
 *                 break             # <<<<<<<<<<<<<<
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):
 *                 raise USBTMCError("Couldn't clear device buffer "
 */
      goto __pyx_L4_break;

      /* "cPyUSBTMC.pyx":576
 *             rv=self.bulk_in.read(USBTMC_SIZE_IOBUFFER, self.timeout)
 *             n +=1
 *             if (len(rv) < max_size): #receive a short packet.             # <<<<<<<<<<<<<<
 *                 break
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):
 */
    }

    /* "cPyUSBTMC.pyx":578
 *             if (len(rv) < max_size): #receive a short packet.
 *                 break
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):             # <<<<<<<<<<<<<<
 *                 raise USBTMCError("Couldn't clear device buffer "
 *                                   "within %d cycles\n"%USBTMC_MAX_READS_TO_CLEAR_BULK_IN)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MAX_READS_TO_CLEAR_BULK_I); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_n, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_t_9)) {

      /* "cPyUSBTMC.pyx":579
 *                 break
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):
 *                 raise USBTMCError("Couldn't clear device buffer "             # <<<<<<<<<<<<<<
 *                                   "within %d cycles\n"%USBTMC_MAX_READS_TO_CLEAR_BULK_IN)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "cPyUSBTMC.pyx":580
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):
 *                 raise USBTMCError("Couldn't clear device buffer "
 *                                   "within %d cycles\n"%USBTMC_MAX_READS_TO_CLEAR_BULK_IN)             # <<<<<<<<<<<<<<
 * 
 *         rv=self.device.ctrl_transfer(
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_USBTMC_MAX_READS_TO_CLEAR_BULK_I); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Couldn_t_clear_device_buffer_wit, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 579, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":578
 *             if (len(rv) < max_size): #receive a short packet.
 *                 break
 *             elif  (n >= USBTMC_MAX_READS_TO_CLEAR_BULK_IN):             # <<<<<<<<<<<<<<
 *                 raise USBTMCError("Couldn't clear device buffer "
 *                                   "within %d cycles\n"%USBTMC_MAX_READS_TO_CLEAR_BULK_IN)
 */
    }
  }
  __pyx_L4_break:;

  /* "cPyUSBTMC.pyx":582
 *                                   "within %d cycles\n"%USBTMC_MAX_READS_TO_CLEAR_BULK_IN)
 * 
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":583
 * 
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_IN_STATUS, # CHECK_STATUS
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cPyUSBTMC.pyx":584
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type             # <<<<<<<<<<<<<<
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_IN_STATUS, # CHECK_STATUS
 *             0, # Reserved
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_1, __pyx_t_5, __pyx_t_10};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_1, __pyx_t_5, __pyx_t_10};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_6, __pyx_t_10);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_10 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cPyUSBTMC.pyx":585
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_IN_STATUS, # CHECK_STATUS             # <<<<<<<<<<<<<<
 *             0, # Reserved
 *             self.bulk_in.bEndpointAddress, # Endpoint
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_CHECK_ABORT_BULK_IN_STATUS); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cPyUSBTMC.pyx":587
 *             USBTMC_REQUEST.CHECK_ABORT_BULK_IN_STATUS, # CHECK_STATUS
 *             0, # Reserved
 *             self.bulk_in.bEndpointAddress, # Endpoint             # <<<<<<<<<<<<<<
 *             0x08, # Number of characters to read
 *             self.timeout)  # Timeout (jiffies)
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cPyUSBTMC.pyx":589
 *             self.bulk_in.bEndpointAddress, # Endpoint
 *             0x08, # Number of characters to read
 *             self.timeout)  # Timeout (jiffies)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_3, __pyx_t_12, __pyx_int_0, __pyx_t_10, __pyx_int_8, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_3, __pyx_t_12, __pyx_int_0, __pyx_t_10, __pyx_int_8, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_6, __pyx_t_12);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_6, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_6, __pyx_t_10);
    __Pyx_INCREF(__pyx_int_8);
    __Pyx_GIVEREF(__pyx_int_8);
    PyTuple_SET_ITEM(__pyx_t_1, 4+__pyx_t_6, __pyx_int_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 5+__pyx_t_6, __pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_12 = 0;
    __pyx_t_10 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_XDECREF_SET(__pyx_v_rv, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":590
 *             0x08, # Number of characters to read
 *             self.timeout)  # Timeout (jiffies)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def clear_bulk_in_halt(self):#USBTMC 3.3.2.4/4.1.1.2
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":569
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])
 * 
 *     def check_abort_bulk_in_status(self):             # <<<<<<<<<<<<<<
 *         n=0
 *         max_size=self.bulk_in.wMaxPacketSize
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.check_abort_bulk_in_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_max_size);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":592
 *         return rv
 * 
 *     def clear_bulk_in_halt(self):#USBTMC 3.3.2.4/4.1.1.2             # <<<<<<<<<<<<<<
 *         # rv=usb.control.clear_feature(self.device, usb.control.ENDPOINT_HALT,
 *         #                              self.bulk_in.bEndpointAddress)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_49clear_bulk_in_halt(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_49clear_bulk_in_halt = {"clear_bulk_in_halt", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_49clear_bulk_in_halt, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_49clear_bulk_in_halt(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_bulk_in_halt (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_48clear_bulk_in_halt(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_48clear_bulk_in_halt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_bulk_in_halt", 0);

  /* "cPyUSBTMC.pyx":595
 *         # rv=usb.control.clear_feature(self.device, usb.control.ENDPOINT_HALT,
 *         #                              self.bulk_in.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":596
 *         #                              self.bulk_in.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_OUT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_STANDARD); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "cPyUSBTMC.pyx":597
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type             # <<<<<<<<<<<<<<
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":598
 *             build_request_type(CTRL_OUT, CTRL_TYPE_STANDARD,
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request             # <<<<<<<<<<<<<<
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 *             self.bulk_in.bEndpointAddress,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_REQ_CLEAR_FEATURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":599
 *                                CTRL_RECIPIENT_ENDPOINT), # bmRequest type
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT             # <<<<<<<<<<<<<<
 *             self.bulk_in.bEndpointAddress,
 *             None, # Although we don't really want data this time
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_usbctrl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ENDPOINT_HALT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":600
 *             usb.REQ_CLEAR_FEATURE, # Clear feature request
 *             usbctrl.ENDPOINT_HALT, # Feature ENDPOINT_HALT
 *             self.bulk_in.bEndpointAddress,             # <<<<<<<<<<<<<<
 *             None, # Although we don't really want data this time
 *             self.timeout)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_in); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_bEndpointAddress); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":602
 *             self.bulk_in.bEndpointAddress,
 *             None, # Although we don't really want data this time
 *             self.timeout)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7, __pyx_t_6, Py_None, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7, __pyx_t_6, Py_None, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_9, __pyx_t_6);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_9, Py_None);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_9, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":603
 *             None, # Although we don't really want data this time
 *             self.timeout)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":592
 *         return rv
 * 
 *     def clear_bulk_in_halt(self):#USBTMC 3.3.2.4/4.1.1.2             # <<<<<<<<<<<<<<
 *         # rv=usb.control.clear_feature(self.device, usb.control.ENDPOINT_HALT,
 *         #                              self.bulk_in.bEndpointAddress)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.clear_bulk_in_halt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":606
 * 
 *     #
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_51clear(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_51clear = {"clear", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_51clear, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_51clear(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_50clear(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_50clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "cPyUSBTMC.pyx":607
 *     #
 *     def clear(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             bmRequestType=build_request_type(
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":608
 *     def clear(self):
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(             # <<<<<<<<<<<<<<
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             bRequest=USBTMC_REQUEST.INITIATE_CLEAR, # INITIATE_CLEAR
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cPyUSBTMC.pyx":609
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             bRequest=USBTMC_REQUEST.INITIATE_CLEAR, # INITIATE_CLEAR
 *             wValue=0, # Interface number (always zero for USBTMC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_bmRequestType, __pyx_t_3) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":610
 *             bmRequestType=build_request_type(
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             bRequest=USBTMC_REQUEST.INITIATE_CLEAR, # INITIATE_CLEAR             # <<<<<<<<<<<<<<
 *             wValue=0, # Interface number (always zero for USBTMC)
 *             wIndex=0, # Reserved
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_INITIATE_CLEAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_bRequest, __pyx_t_4) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_wValue, __pyx_int_0) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 608, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":614
 *             wIndex=0, # Reserved
 *             data_or_wLength=1, # Number of characters to read
 *             timeout=self.timeout) # Timeout (jiffies)             # <<<<<<<<<<<<<<
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_clear_status()
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_t_4) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":607
 *     #
 *     def clear(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             bmRequestType=build_request_type(
 *                 CTRL_IN, CTRL_TYPE_CLASS, CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":615
 *             data_or_wLength=1, # Number of characters to read
 *             timeout=self.timeout) # Timeout (jiffies)
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_clear_status()
 *             n=0
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_11) {

    /* "cPyUSBTMC.pyx":616
 *             timeout=self.timeout) # Timeout (jiffies)
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_clear_status()             # <<<<<<<<<<<<<<
 *             n=0
 *             while (rv[0] == USBTMC_Status.PENDING):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_clear_status); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":617
 *         if (rv[0] == USBTMC_Status.SUCCESS):
 *             rv=self.check_clear_status()
 *             n=0             # <<<<<<<<<<<<<<
 *             while (rv[0] == USBTMC_Status.PENDING):
 *                 time.sleep(0.1)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_n = __pyx_int_0;

    /* "cPyUSBTMC.pyx":618
 *             rv=self.check_clear_status()
 *             n=0
 *             while (rv[0] == USBTMC_Status.PENDING):             # <<<<<<<<<<<<<<
 *                 time.sleep(0.1)
 *                 rv=self.check_clear_status()
 */
    while (1) {
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PENDING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 618, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_11) break;

      /* "cPyUSBTMC.pyx":619
 *             n=0
 *             while (rv[0] == USBTMC_Status.PENDING):
 *                 time.sleep(0.1)             # <<<<<<<<<<<<<<
 *                 rv=self.check_clear_status()
 *                 n+=1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sleep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(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);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_float_0_1) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_float_0_1);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":620
 *             while (rv[0] == USBTMC_Status.PENDING):
 *                 time.sleep(0.1)
 *                 rv=self.check_clear_status()             # <<<<<<<<<<<<<<
 *                 n+=1
 *                 if n > 1000:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_clear_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && 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);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":621
 *                 time.sleep(0.1)
 *                 rv=self.check_clear_status()
 *                 n+=1             # <<<<<<<<<<<<<<
 *                 if n > 1000:
 *                     raise USBTMCError("clear status failed: too many iteration")
 */
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cPyUSBTMC.pyx":622
 *                 rv=self.check_clear_status()
 *                 n+=1
 *                 if n > 1000:             # <<<<<<<<<<<<<<
 *                     raise USBTMCError("clear status failed: too many iteration")
 *             # re-establish synchronization
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_n, __pyx_int_1000, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__pyx_t_11)) {

        /* "cPyUSBTMC.pyx":623
 *                 n+=1
 *                 if n > 1000:
 *                     raise USBTMCError("clear status failed: too many iteration")             # <<<<<<<<<<<<<<
 *             # re-establish synchronization
 *             self.clear_halt()
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(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);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_clear_status_failed_too_many_ite) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_clear_status_failed_too_many_ite);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __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_ERR(0, 623, __pyx_L1_error)

        /* "cPyUSBTMC.pyx":622
 *                 rv=self.check_clear_status()
 *                 n+=1
 *                 if n > 1000:             # <<<<<<<<<<<<<<
 *                     raise USBTMCError("clear status failed: too many iteration")
 *             # re-establish synchronization
 */
      }
    }

    /* "cPyUSBTMC.pyx":625
 *                     raise USBTMCError("clear status failed: too many iteration")
 *             # re-establish synchronization
 *             self.clear_halt()             # <<<<<<<<<<<<<<
 *             return
 *         return rv
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clear_halt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && 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);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":626
 *             # re-establish synchronization
 *             self.clear_halt()
 *             return             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":615
 *             data_or_wLength=1, # Number of characters to read
 *             timeout=self.timeout) # Timeout (jiffies)
 *         if (rv[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             rv=self.check_clear_status()
 *             n=0
 */
  }

  /* "cPyUSBTMC.pyx":627
 *             self.clear_halt()
 *             return
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def check_clear_status(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":606
 * 
 *     #
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":629
 *         return rv
 * 
 *     def check_clear_status(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_53check_clear_status(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_53check_clear_status = {"check_clear_status", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_53check_clear_status, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_53check_clear_status(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_clear_status (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_52check_clear_status(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_52check_clear_status(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_clear_status", 0);

  /* "cPyUSBTMC.pyx":630
 * 
 *     def check_clear_status(self):
 *         rv=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":631
 *     def check_clear_status(self):
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USBTMC_REQUEST.CHECK_CLEAR_STATUS, # INITIATE_CLEAR
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "cPyUSBTMC.pyx":632
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             USBTMC_REQUEST.CHECK_CLEAR_STATUS, # INITIATE_CLEAR
 *             0, # Interface number (always zero for USBTMC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":633
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USBTMC_REQUEST.CHECK_CLEAR_STATUS, # INITIATE_CLEAR             # <<<<<<<<<<<<<<
 *             0, # Interface number (always zero for USBTMC)
 *             0, # Reserved
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_CHECK_CLEAR_STATUS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":637
 *             0, # Reserved
 *             2, # Number of characters to read
 *             self.timeout)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_2, __pyx_t_10, __pyx_int_0, __pyx_int_0, __pyx_int_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_2, __pyx_t_10, __pyx_int_0, __pyx_int_0, __pyx_int_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_10);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_9, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_9, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_9, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_9, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":638
 *             2, # Number of characters to read
 *             self.timeout)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def get_capabilities(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":629
 *         return rv
 * 
 *     def check_clear_status(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.check_clear_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":640
 *         return rv
 * 
 *     def get_capabilities(self):             # <<<<<<<<<<<<<<
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_55get_capabilities(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_55get_capabilities = {"get_capabilities", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_55get_capabilities, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_55get_capabilities(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_capabilities (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_54get_capabilities(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_54get_capabilities(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_capabilities", 0);

  /* "cPyUSBTMC.pyx":642
 *     def get_capabilities(self):
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":643
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USBTMC_REQUEST.GET_CAPABILITIES,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cPyUSBTMC.pyx":644
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             USBTMC_REQUEST.GET_CAPABILITIES,
 *             wValue=0x0000,wIndex=0,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":645
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USBTMC_REQUEST.GET_CAPABILITIES,             # <<<<<<<<<<<<<<
 *             wValue=0x0000,wIndex=0,
 *             data_or_wLength=0x0018,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_GET_CAPABILITIES); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":642
 *     def get_capabilities(self):
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":646
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USBTMC_REQUEST.GET_CAPABILITIES,
 *             wValue=0x0000,wIndex=0,             # <<<<<<<<<<<<<<
 *             data_or_wLength=0x0018,
 *             timeout=self.timeout)
 */
  __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wValue, __pyx_int_0) < 0) __PYX_ERR(0, 646, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 646, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_data_or_wLength, __pyx_int_24) < 0) __PYX_ERR(0, 646, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":648
 *             wValue=0x0000,wIndex=0,
 *             data_or_wLength=0x0018,
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         if (b[0] == USBTMC_Status.SUCCESS):
 *             self.capabilities = USBTMC_Capabilities(b)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":642
 *     def get_capabilities(self):
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":649
 *             data_or_wLength=0x0018,
 *             timeout=self.timeout)
 *         if (b[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             self.capabilities = USBTMC_Capabilities(b)
 *             return self.capabilities
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_SUCCESS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {

    /* "cPyUSBTMC.pyx":650
 *             timeout=self.timeout)
 *         if (b[0] == USBTMC_Status.SUCCESS):
 *             self.capabilities = USBTMC_Capabilities(b)             # <<<<<<<<<<<<<<
 *             return self.capabilities
 *         return None
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_Capabilities); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_b) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_b);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_capabilities, __pyx_t_9) < 0) __PYX_ERR(0, 650, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cPyUSBTMC.pyx":651
 *         if (b[0] == USBTMC_Status.SUCCESS):
 *             self.capabilities = USBTMC_Capabilities(b)
 *             return self.capabilities             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capabilities); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":649
 *             data_or_wLength=0x0018,
 *             timeout=self.timeout)
 *         if (b[0] == USBTMC_Status.SUCCESS):             # <<<<<<<<<<<<<<
 *             self.capabilities = USBTMC_Capabilities(b)
 *             return self.capabilities
 */
  }

  /* "cPyUSBTMC.pyx":652
 *             self.capabilities = USBTMC_Capabilities(b)
 *             return self.capabilities
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def indicator_pulse(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":640
 *         return rv
 * 
 *     def get_capabilities(self):             # <<<<<<<<<<<<<<
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.get_capabilities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":654
 *         return None
 * 
 *     def indicator_pulse(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_57indicator_pulse(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USBTMC_device_57indicator_pulse = {"indicator_pulse", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USBTMC_device_57indicator_pulse, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USBTMC_device_57indicator_pulse(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("indicator_pulse (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USBTMC_device_56indicator_pulse(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USBTMC_device_56indicator_pulse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("indicator_pulse", 0);

  /* "cPyUSBTMC.pyx":655
 * 
 *     def indicator_pulse(self):
 *         if self.capabilities.indicator_pulse:             # <<<<<<<<<<<<<<
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capabilities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_indicator_pulse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_3)) {

    /* "cPyUSBTMC.pyx":657
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":658
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USBTMC_REQUEST.INDICATOR_PULSE,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "cPyUSBTMC.pyx":659
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *                 USBTMC_REQUEST.INDICATOR_PULSE,
 *                 data_or_wLength=0x0001,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":660
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USBTMC_REQUEST.INDICATOR_PULSE,             # <<<<<<<<<<<<<<
 *                 data_or_wLength=0x0001,
 *                 timeout=self.timeout)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_INDICATOR_PULSE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":657
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;

    /* "cPyUSBTMC.pyx":661
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USBTMC_REQUEST.INDICATOR_PULSE,
 *                 data_or_wLength=0x0001,             # <<<<<<<<<<<<<<
 *                 timeout=self.timeout)
 *         else:
 */
    __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 661, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":662
 *                 USBTMC_REQUEST.INDICATOR_PULSE,
 *                 data_or_wLength=0x0001,
 *                 timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         else:
 *             raise USBError("INDICATOR_PULSE is not supported on this device")
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_2) < 0) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":657
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_b = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":655
 * 
 *     def indicator_pulse(self):
 *         if self.capabilities.indicator_pulse:             # <<<<<<<<<<<<<<
 *             # see Table 38- Indicator_pulse setup packet
 *             b=self.device.ctrl_transfer(
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":664
 *                 timeout=self.timeout)
 *         else:
 *             raise USBError("INDICATOR_PULSE is not supported on this device")             # <<<<<<<<<<<<<<
 * 
 * class USB488_device(USBTMC_device):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_USBError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_4, __pyx_kp_s_INDICATOR_PULSE_is_not_supported) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_s_INDICATOR_PULSE_is_not_supported);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 664, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":654
 *         return None
 * 
 *     def indicator_pulse(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_device.indicator_pulse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":668
 * class USB488_device(USBTMC_device):
 *     #mandatory commands
 *     def CLS(self):             # <<<<<<<<<<<<<<
 *         self.write("*CLS\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_1CLS(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_1CLS = {"CLS", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_1CLS, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_1CLS(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("CLS (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_CLS(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_CLS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("CLS", 0);

  /* "cPyUSBTMC.pyx":669
 *     #mandatory commands
 *     def CLS(self):
 *         self.write("*CLS\n")             # <<<<<<<<<<<<<<
 * 
 *     def ESE(self,query=False):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_CLS) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_CLS);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __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;

  /* "cPyUSBTMC.pyx":668
 * class USB488_device(USBTMC_device):
 *     #mandatory commands
 *     def CLS(self):             # <<<<<<<<<<<<<<
 *         self.write("*CLS\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.CLS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":671
 *         self.write("*CLS\n")
 * 
 *     def ESE(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*ESE?;\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_3ESE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_3ESE = {"ESE", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_3ESE, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_3ESE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ESE (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ESE") < 0)) __PYX_ERR(0, 671, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ESE", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 671, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.ESE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_2ESE(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_2ESE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("ESE", 0);

  /* "cPyUSBTMC.pyx":672
 * 
 *     def ESE(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*ESE?;\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 672, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":673
 *     def ESE(self,query=False):
 *         if query:
 *             return self.ask("*ESE?;\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*ESE;\n")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_ESE) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_ESE);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 673, __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;

    /* "cPyUSBTMC.pyx":672
 * 
 *     def ESE(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*ESE?;\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":675
 *             return self.ask("*ESE?;\n")
 *         else:
 *             self.write("*ESE;\n")             # <<<<<<<<<<<<<<
 * 
 *     def ESR(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_ESE_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_ESE_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __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;
  }

  /* "cPyUSBTMC.pyx":671
 *         self.write("*CLS\n")
 * 
 *     def ESE(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*ESE?;\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.ESE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":677
 *             self.write("*ESE;\n")
 * 
 *     def ESR(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*ESQ?;\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_5ESR(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_5ESR = {"ESR", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_5ESR, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_5ESR(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ESR (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_4ESR(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_4ESR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ESR", 0);

  /* "cPyUSBTMC.pyx":678
 * 
 *     def ESR(self):
 *         return self.ask("*ESQ?;\n")             # <<<<<<<<<<<<<<
 * 
 *     def IDN(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_ESQ) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_ESQ);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __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;

  /* "cPyUSBTMC.pyx":677
 *             self.write("*ESE;\n")
 * 
 *     def ESR(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*ESQ?;\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.ESR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":680
 *         return self.ask("*ESQ?;\n")
 * 
 *     def IDN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*IDN?;\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_7IDN(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_7IDN = {"IDN", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_7IDN, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_7IDN(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("IDN (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_6IDN(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_6IDN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("IDN", 0);

  /* "cPyUSBTMC.pyx":681
 * 
 *     def IDN(self):
 *         return self.ask("*IDN?;\n")             # <<<<<<<<<<<<<<
 * 
 *     def OPC(self,query=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_IDN_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_IDN_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __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;

  /* "cPyUSBTMC.pyx":680
 *         return self.ask("*ESQ?;\n")
 * 
 *     def IDN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*IDN?;\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.IDN", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":683
 *         return self.ask("*IDN?;\n")
 * 
 *     def OPC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*OPC?;\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_9OPC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_9OPC = {"OPC", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_9OPC, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_9OPC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("OPC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "OPC") < 0)) __PYX_ERR(0, 683, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("OPC", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 683, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.OPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_8OPC(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_8OPC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("OPC", 0);

  /* "cPyUSBTMC.pyx":684
 * 
 *     def OPC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*OPC?;\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 684, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":685
 *     def OPC(self,query=False):
 *         if query:
 *             return self.ask("*OPC?;\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*OPC;\n")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_OPC) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_OPC);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __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;

    /* "cPyUSBTMC.pyx":684
 * 
 *     def OPC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*OPC?;\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":687
 *             return self.ask("*OPC?;\n")
 *         else:
 *             self.write("*OPC;\n")             # <<<<<<<<<<<<<<
 * 
 *     def RST(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_OPC_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_OPC_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __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;
  }

  /* "cPyUSBTMC.pyx":683
 *         return self.ask("*IDN?;\n")
 * 
 *     def OPC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*OPC?;\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.OPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":689
 *             self.write("*OPC;\n")
 * 
 *     def RST(self):             # <<<<<<<<<<<<<<
 *         self.write("*RST;\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_11RST(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_11RST = {"RST", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_11RST, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_11RST(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RST (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_10RST(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_10RST(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("RST", 0);

  /* "cPyUSBTMC.pyx":690
 * 
 *     def RST(self):
 *         self.write("*RST;\n")             # <<<<<<<<<<<<<<
 * 
 *     def SRE(self,mask=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_RST) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_RST);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __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;

  /* "cPyUSBTMC.pyx":689
 *             self.write("*OPC;\n")
 * 
 *     def RST(self):             # <<<<<<<<<<<<<<
 *         self.write("*RST;\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RST", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":692
 *         self.write("*RST;\n")
 * 
 *     def SRE(self,mask=None):             # <<<<<<<<<<<<<<
 *         if mask == None:
 *             return self.ask("*SRE?;\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_13SRE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_13SRE = {"SRE", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_13SRE, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_13SRE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mask = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SRE (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_mask,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SRE") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_mask = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SRE", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SRE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_12SRE(__pyx_self, __pyx_v_self, __pyx_v_mask);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_12SRE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mask) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SRE", 0);

  /* "cPyUSBTMC.pyx":693
 * 
 *     def SRE(self,mask=None):
 *         if mask == None:             # <<<<<<<<<<<<<<
 *             return self.ask("*SRE?;\n")
 *         else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_mask, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":694
 *     def SRE(self,mask=None):
 *         if mask == None:
 *             return self.ask("*SRE?;\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*SRE %d;\n"%mask)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_SRE) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_SRE);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":693
 * 
 *     def SRE(self,mask=None):
 *         if mask == None:             # <<<<<<<<<<<<<<
 *             return self.ask("*SRE?;\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":696
 *             return self.ask("*SRE?;\n")
 *         else:
 *             self.write("*SRE %d;\n"%mask)             # <<<<<<<<<<<<<<
 * 
 *     def STB(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_SRE_d, __pyx_v_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __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;
  }

  /* "cPyUSBTMC.pyx":692
 *         self.write("*RST;\n")
 * 
 *     def SRE(self,mask=None):             # <<<<<<<<<<<<<<
 *         if mask == None:
 *             return self.ask("*SRE?;\n")
 */

  /* 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_5);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SRE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":698
 *             self.write("*SRE %d;\n"%mask)
 * 
 *     def STB(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*STB?;\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_15STB(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_15STB = {"STB", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_15STB, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_15STB(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("STB (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_14STB(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_14STB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("STB", 0);

  /* "cPyUSBTMC.pyx":699
 * 
 *     def STB(self):
 *         return self.ask("*STB?;\n")             # <<<<<<<<<<<<<<
 * 
 *     def TRG(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_STB) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_STB);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __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;

  /* "cPyUSBTMC.pyx":698
 *             self.write("*SRE %d;\n"%mask)
 * 
 *     def STB(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*STB?;\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.STB", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":701
 *         return self.ask("*STB?;\n")
 * 
 *     def TRG(self):             # <<<<<<<<<<<<<<
 *         self.write("*TRG\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_17TRG(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_17TRG = {"TRG", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_17TRG, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_17TRG(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("TRG (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_16TRG(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_16TRG(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("TRG", 0);

  /* "cPyUSBTMC.pyx":702
 * 
 *     def TRG(self):
 *         self.write("*TRG\n")             # <<<<<<<<<<<<<<
 * 
 *     def TST(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_TRG_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_TRG_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __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;

  /* "cPyUSBTMC.pyx":701
 *         return self.ask("*STB?;\n")
 * 
 *     def TRG(self):             # <<<<<<<<<<<<<<
 *         self.write("*TRG\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.TRG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":704
 *         self.write("*TRG\n")
 * 
 *     def TST(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TST?\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_19TST(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_19TST = {"TST", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_19TST, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_19TST(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("TST (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_18TST(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_18TST(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("TST", 0);

  /* "cPyUSBTMC.pyx":705
 * 
 *     def TST(self):
 *         return self.ask("*TST?\n")             # <<<<<<<<<<<<<<
 * 
 *     def WAI(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_TST) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_TST);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __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;

  /* "cPyUSBTMC.pyx":704
 *         self.write("*TRG\n")
 * 
 *     def TST(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TST?\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.TST", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":707
 *         return self.ask("*TST?\n")
 * 
 *     def WAI(self):             # <<<<<<<<<<<<<<
 *         self.write("*WAI\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_21WAI(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_21WAI = {"WAI", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_21WAI, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_21WAI(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WAI (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_20WAI(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_20WAI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WAI", 0);

  /* "cPyUSBTMC.pyx":708
 * 
 *     def WAI(self):
 *         self.write("*WAI\n")             # <<<<<<<<<<<<<<
 * 
 *     # optional commands
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WAI) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WAI);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __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;

  /* "cPyUSBTMC.pyx":707
 *         return self.ask("*TST?\n")
 * 
 *     def WAI(self):             # <<<<<<<<<<<<<<
 *         self.write("*WAI\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.WAI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":712
 *     # optional commands
 * 
 *     def CAL(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_23CAL(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USB488_device_22CAL[] = "\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_23CAL = {"CAL", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_23CAL, METH_O, __pyx_doc_9cPyUSBTMC_13USB488_device_22CAL};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_23CAL(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("CAL (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_22CAL(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_22CAL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("CAL", 0);

  /* "cPyUSBTMC.pyx":715
 *         """
 *         """
 *         return self.ask("*CAL?\n")             # <<<<<<<<<<<<<<
 * 
 *     def DDT(self,query=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_CAL) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_CAL);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __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;

  /* "cPyUSBTMC.pyx":712
 *     # optional commands
 * 
 *     def CAL(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.CAL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":717
 *         return self.ask("*CAL?\n")
 * 
 *     def DDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*DDT?\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_25DDT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_25DDT = {"DDT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_25DDT, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_25DDT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DDT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DDT") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DDT", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.DDT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_24DDT(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_24DDT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("DDT", 0);

  /* "cPyUSBTMC.pyx":718
 * 
 *     def DDT(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*DDT?\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 718, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":719
 *     def DDT(self,query=False):
 *         if query:
 *             return self.ask("*DDT?\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*DDT\n")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_DDT) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_DDT);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __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;

    /* "cPyUSBTMC.pyx":718
 * 
 *     def DDT(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*DDT?\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":721
 *             return self.ask("*DDT?\n")
 *         else:
 *             self.write("*DDT\n")             # <<<<<<<<<<<<<<
 * 
 *     def DMC(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_DDT_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_DDT_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __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;
  }

  /* "cPyUSBTMC.pyx":717
 *         return self.ask("*CAL?\n")
 * 
 *     def DDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*DDT?\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.DDT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":723
 *             self.write("*DDT\n")
 * 
 *     def DMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*DMC\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_27DMC(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_27DMC = {"DMC", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_27DMC, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_27DMC(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DMC (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_26DMC(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_26DMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DMC", 0);

  /* "cPyUSBTMC.pyx":724
 * 
 *     def DMC(self):
 *         self.write("*DMC\n")             # <<<<<<<<<<<<<<
 * 
 *     def EMC(self,query=False):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DMC) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DMC);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __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;

  /* "cPyUSBTMC.pyx":723
 *             self.write("*DDT\n")
 * 
 *     def DMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*DMC\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.DMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":726
 *         self.write("*DMC\n")
 * 
 *     def EMC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*EMC?\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_29EMC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_29EMC = {"EMC", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_29EMC, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_29EMC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("EMC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "EMC") < 0)) __PYX_ERR(0, 726, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("EMC", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.EMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_28EMC(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_28EMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("EMC", 0);

  /* "cPyUSBTMC.pyx":727
 * 
 *     def EMC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*EMC?\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 727, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":728
 *     def EMC(self,query=False):
 *         if query:
 *             return self.ask("*EMC?\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*EMC\n")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_EMC) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_EMC);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __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;

    /* "cPyUSBTMC.pyx":727
 * 
 *     def EMC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*EMC?\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":730
 *             return self.ask("*EMC?\n")
 *         else:
 *             self.write("*EMC\n")             # <<<<<<<<<<<<<<
 *     def GMC(self):
 *         return self.ask("*GMC?\n")
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_EMC_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_EMC_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __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;
  }

  /* "cPyUSBTMC.pyx":726
 *         self.write("*DMC\n")
 * 
 *     def EMC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*EMC?\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.EMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":731
 *         else:
 *             self.write("*EMC\n")
 *     def GMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*GMC?\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_31GMC(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_31GMC = {"GMC", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_31GMC, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_31GMC(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GMC (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_30GMC(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_30GMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GMC", 0);

  /* "cPyUSBTMC.pyx":732
 *             self.write("*EMC\n")
 *     def GMC(self):
 *         return self.ask("*GMC?\n")             # <<<<<<<<<<<<<<
 * 
 *     def LMC(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_GMC) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_GMC);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __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;

  /* "cPyUSBTMC.pyx":731
 *         else:
 *             self.write("*EMC\n")
 *     def GMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*GMC?\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.GMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":734
 *         return self.ask("*GMC?\n")
 * 
 *     def LMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LMC?\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_33LMC(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_33LMC = {"LMC", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_33LMC, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_33LMC(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LMC (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_32LMC(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_32LMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("LMC", 0);

  /* "cPyUSBTMC.pyx":735
 * 
 *     def LMC(self):
 *         return self.ask("*LMC?\n")             # <<<<<<<<<<<<<<
 * 
 *     def LRN(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_LMC) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_LMC);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __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;

  /* "cPyUSBTMC.pyx":734
 *         return self.ask("*GMC?\n")
 * 
 *     def LMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LMC?\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.LMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":737
 *         return self.ask("*LMC?\n")
 * 
 *     def LRN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LRN?\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_35LRN(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_35LRN = {"LRN", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_35LRN, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_35LRN(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LRN (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_34LRN(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_34LRN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("LRN", 0);

  /* "cPyUSBTMC.pyx":738
 * 
 *     def LRN(self):
 *         return self.ask("*LRN?\n")             # <<<<<<<<<<<<<<
 * 
 *     def PSC(self,query=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_LRN) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_LRN);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __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;

  /* "cPyUSBTMC.pyx":737
 *         return self.ask("*LMC?\n")
 * 
 *     def LRN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LRN?\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.LRN", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":740
 *         return self.ask("*LRN?\n")
 * 
 *     def PSC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*PSC?\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_37PSC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_37PSC = {"PSC", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_37PSC, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_37PSC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("PSC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "PSC") < 0)) __PYX_ERR(0, 740, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("PSC", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 740, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.PSC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_36PSC(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_36PSC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("PSC", 0);

  /* "cPyUSBTMC.pyx":741
 * 
 *     def PSC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*PSC?\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 741, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":742
 *     def PSC(self,query=False):
 *         if query:
 *             return self.ask("*PSC?\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*PSC\n")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_PSC) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_PSC);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __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;

    /* "cPyUSBTMC.pyx":741
 * 
 *     def PSC(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*PSC?\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":744
 *             return self.ask("*PSC?\n")
 *         else:
 *             self.write("*PSC\n")             # <<<<<<<<<<<<<<
 * 
 *     def PUD(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_PSC_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_PSC_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __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;
  }

  /* "cPyUSBTMC.pyx":740
 *         return self.ask("*LRN?\n")
 * 
 *     def PSC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*PSC?\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.PSC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":746
 *             self.write("*PSC\n")
 * 
 *     def PUD(self):             # <<<<<<<<<<<<<<
 *         self.write("*PUD\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_39PUD(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_39PUD = {"PUD", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_39PUD, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_39PUD(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("PUD (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_38PUD(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_38PUD(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PUD", 0);

  /* "cPyUSBTMC.pyx":747
 * 
 *     def PUD(self):
 *         self.write("*PUD\n")             # <<<<<<<<<<<<<<
 * 
 *     def RCL(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_PUD) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_PUD);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __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;

  /* "cPyUSBTMC.pyx":746
 *             self.write("*PSC\n")
 * 
 *     def PUD(self):             # <<<<<<<<<<<<<<
 *         self.write("*PUD\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.PUD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":749
 *         self.write("*PUD\n")
 * 
 *     def RCL(self):             # <<<<<<<<<<<<<<
 *         self.write("*RCL\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_41RCL(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_41RCL = {"RCL", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_41RCL, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_41RCL(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RCL (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_40RCL(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_40RCL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("RCL", 0);

  /* "cPyUSBTMC.pyx":750
 * 
 *     def RCL(self):
 *         self.write("*RCL\n")             # <<<<<<<<<<<<<<
 * 
 *     def RDT(self,query=False):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_RCL) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_RCL);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __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;

  /* "cPyUSBTMC.pyx":749
 *         self.write("*PUD\n")
 * 
 *     def RCL(self):             # <<<<<<<<<<<<<<
 *         self.write("*RCL\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RCL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":752
 *         self.write("*RCL\n")
 * 
 *     def RDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*RDT?\n")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_43RDT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_43RDT = {"RDT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_43RDT, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_43RDT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RDT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RDT") < 0)) __PYX_ERR(0, 752, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RDT", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 752, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RDT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_42RDT(__pyx_self, __pyx_v_self, __pyx_v_query);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_42RDT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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_RefNannySetupContext("RDT", 0);

  /* "cPyUSBTMC.pyx":753
 * 
 *     def RDT(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*RDT?\n")
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_query); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 753, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":754
 *     def RDT(self,query=False):
 *         if query:
 *             return self.ask("*RDT?\n")             # <<<<<<<<<<<<<<
 *         else:
 *             self.write("*RDT")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_RDT) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_RDT);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __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;

    /* "cPyUSBTMC.pyx":753
 * 
 *     def RDT(self,query=False):
 *         if query:             # <<<<<<<<<<<<<<
 *             return self.ask("*RDT?\n")
 *         else:
 */
  }

  /* "cPyUSBTMC.pyx":756
 *             return self.ask("*RDT?\n")
 *         else:
 *             self.write("*RDT")             # <<<<<<<<<<<<<<
 * 
 *     def RMC(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_RDT_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_RDT_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __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;
  }

  /* "cPyUSBTMC.pyx":752
 *         self.write("*RCL\n")
 * 
 *     def RDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*RDT?\n")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RDT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":758
 *             self.write("*RDT")
 * 
 *     def RMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*RMC\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_45RMC(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_45RMC = {"RMC", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_45RMC, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_45RMC(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RMC (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_44RMC(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_44RMC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("RMC", 0);

  /* "cPyUSBTMC.pyx":759
 * 
 *     def RMC(self):
 *         self.write("*RMC\n")             # <<<<<<<<<<<<<<
 * 
 *     def SAV(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_RMC) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_RMC);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __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;

  /* "cPyUSBTMC.pyx":758
 *             self.write("*RDT")
 * 
 *     def RMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*RMC\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":761
 *         self.write("*RMC\n")
 * 
 *     def SAV(self):             # <<<<<<<<<<<<<<
 *         self.write("*SAV\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_47SAV(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_47SAV = {"SAV", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_47SAV, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_47SAV(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SAV (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_46SAV(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_46SAV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SAV", 0);

  /* "cPyUSBTMC.pyx":762
 * 
 *     def SAV(self):
 *         self.write("*SAV\n")             # <<<<<<<<<<<<<<
 * 
 *     def SAD(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SAV) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SAV);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __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;

  /* "cPyUSBTMC.pyx":761
 *         self.write("*RMC\n")
 * 
 *     def SAV(self):             # <<<<<<<<<<<<<<
 *         self.write("*SAV\n")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SAV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":764
 *         self.write("*SAV\n")
 * 
 *     def SAD(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_49SAD(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_49SAD = {"SAD", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_49SAD, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_49SAD(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SAD (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_48SAD(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_48SAD(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SAD", 0);

  /* "cPyUSBTMC.pyx":765
 * 
 *     def SAD(self):
 *         self.write("*SDS")             # <<<<<<<<<<<<<<
 * 
 *     def SDS(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SDS) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SDS);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __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;

  /* "cPyUSBTMC.pyx":764
 *         self.write("*SAV\n")
 * 
 *     def SAD(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SAD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":767
 *         self.write("*SDS")
 * 
 *     def SDS(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 *     #
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_51SDS(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_51SDS = {"SDS", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_51SDS, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_51SDS(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SDS (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_50SDS(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_50SDS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SDS", 0);

  /* "cPyUSBTMC.pyx":768
 * 
 *     def SDS(self):
 *         self.write("*SDS")             # <<<<<<<<<<<<<<
 *     #
 *     def OPT(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SDS) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SDS);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __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;

  /* "cPyUSBTMC.pyx":767
 *         self.write("*SDS")
 * 
 *     def SDS(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 *     #
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SDS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":770
 *         self.write("*SDS")
 *     #
 *     def OPT(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*OPT?\n")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_53OPT(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_53OPT = {"OPT", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_53OPT, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_53OPT(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("OPT (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_52OPT(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_52OPT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("OPT", 0);

  /* "cPyUSBTMC.pyx":771
 *     #
 *     def OPT(self):
 *         return self.ask("*OPT?\n")             # <<<<<<<<<<<<<<
 * 
 *     def TER(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_OPT) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_OPT);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __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;

  /* "cPyUSBTMC.pyx":770
 *         self.write("*SDS")
 *     #
 *     def OPT(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*OPT?\n")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.OPT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":773
 *         return self.ask("*OPT?\n")
 * 
 *     def TER(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TER?\n")
 *     #
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_55TER(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_55TER = {"TER", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_55TER, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_55TER(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("TER (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_54TER(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_54TER(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("TER", 0);

  /* "cPyUSBTMC.pyx":774
 * 
 *     def TER(self):
 *         return self.ask("*TER?\n")             # <<<<<<<<<<<<<<
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_TER) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_TER);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __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;

  /* "cPyUSBTMC.pyx":773
 *         return self.ask("*OPT?\n")
 * 
 *     def TER(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TER?\n")
 *     #
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.TER", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":776
 *         return self.ask("*TER?\n")
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15             # <<<<<<<<<<<<<<
 *         if enable:
 *             b=self.device.ctrl_transfer(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_57RemoteEnable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_57RemoteEnable = {"RemoteEnable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13USB488_device_57RemoteEnable, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_57RemoteEnable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_enable = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RemoteEnable (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_enable,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RemoteEnable") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_enable = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RemoteEnable", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RemoteEnable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_56RemoteEnable(__pyx_self, __pyx_v_self, __pyx_v_enable);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_56RemoteEnable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enable) {
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("RemoteEnable", 0);

  /* "cPyUSBTMC.pyx":777
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15
 *         if enable:             # <<<<<<<<<<<<<<
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_enable); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 777, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cPyUSBTMC.pyx":778
 *     def RemoteEnable(self,enable=True):#Table 15
 *         if enable:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":779
 *         if enable:
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "cPyUSBTMC.pyx":780
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *                 USB488_REQUEST.REN_CONTROL,
 *                 wValue= 1, # should I use struct? to avoide endianess
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_5, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 779, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":781
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,             # <<<<<<<<<<<<<<
 *                 wValue= 1, # should I use struct? to avoide endianess
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USB488_REQUEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_REN_CONTROL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":778
 *     def RemoteEnable(self,enable=True):#Table 15
 *         if enable:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;

    /* "cPyUSBTMC.pyx":782
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,
 *                 wValue= 1, # should I use struct? to avoide endianess             # <<<<<<<<<<<<<<
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 *                 data_or_wLength=0x1,
 */
    __pyx_t_10 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_wValue, __pyx_int_1) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 782, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":785
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 *                 data_or_wLength=0x1,
 *                 timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         else:
 *             b=self.device.ctrl_transfer(
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_2) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":778
 *     def RemoteEnable(self,enable=True):#Table 15
 *         if enable:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_b = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":777
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15
 *         if enable:             # <<<<<<<<<<<<<<
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":787
 *                 timeout=self.timeout)
 *         else:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":788
 *         else:
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "cPyUSBTMC.pyx":789
 *             b=self.device.ctrl_transfer(
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *                 USB488_REQUEST.REN_CONTROL,
 *                 wValue= 0, # should I use struct? to avoide endianess
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_7, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_7, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_9, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":790
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,             # <<<<<<<<<<<<<<
 *                 wValue= 0, # should I use struct? to avoide endianess
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USB488_REQUEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_REN_CONTROL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":787
 *                 timeout=self.timeout)
 *         else:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
    __pyx_t_2 = 0;
    __pyx_t_8 = 0;

    /* "cPyUSBTMC.pyx":791
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *                 USB488_REQUEST.REN_CONTROL,
 *                 wValue= 0, # should I use struct? to avoide endianess             # <<<<<<<<<<<<<<
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 *                 data_or_wLength=0x1,
 */
    __pyx_t_8 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_wValue, __pyx_int_0) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 791, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":794
 *                 wIndex= 0, # Interface number (always zero for USBTMC)
 *                 data_or_wLength=0x1,
 *                 timeout=self.timeout)             # <<<<<<<<<<<<<<
 * 
 *         return b #USBTMC_Status
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_timeout, __pyx_t_2) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":787
 *                 timeout=self.timeout)
 *         else:
 *             b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *                 build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                    CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_b = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":796
 *                 timeout=self.timeout)
 * 
 *         return b #USBTMC_Status             # <<<<<<<<<<<<<<
 * 
 *     def LocalLockOut(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":776
 *         return self.ask("*TER?\n")
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15             # <<<<<<<<<<<<<<
 *         if enable:
 *             b=self.device.ctrl_transfer(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.RemoteEnable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":798
 *         return b #USBTMC_Status
 * 
 *     def LocalLockOut(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_59LocalLockOut(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_59LocalLockOut = {"LocalLockOut", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_59LocalLockOut, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_59LocalLockOut(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LocalLockOut (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_58LocalLockOut(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_58LocalLockOut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("LocalLockOut", 0);

  /* "cPyUSBTMC.pyx":799
 * 
 *     def LocalLockOut(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":800
 *     def LocalLockOut(self):
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.LOCAL_LOCKOUT,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cPyUSBTMC.pyx":801
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             USB488_REQUEST.LOCAL_LOCKOUT,
 *             wValue= 0, # tabel 19
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":802
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.LOCAL_LOCKOUT,             # <<<<<<<<<<<<<<
 *             wValue= 0, # tabel 19
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USB488_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LOCAL_LOCKOUT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":799
 * 
 *     def LocalLockOut(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":803
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.LOCAL_LOCKOUT,
 *             wValue= 0, # tabel 19             # <<<<<<<<<<<<<<
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0001,
 */
  __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wValue, __pyx_int_0) < 0) __PYX_ERR(0, 803, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 803, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 803, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":806
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0001,
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         return b #USBTMC_Status
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":799
 * 
 *     def LocalLockOut(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":807
 *             data_or_wLength=0x0001,
 *             timeout=self.timeout)
 *         return b #USBTMC_Status             # <<<<<<<<<<<<<<
 * 
 *     def GoToLocal(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":798
 *         return b #USBTMC_Status
 * 
 *     def LocalLockOut(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.LocalLockOut", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":809
 *         return b #USBTMC_Status
 * 
 *     def GoToLocal(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_61GoToLocal(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_61GoToLocal = {"GoToLocal", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_61GoToLocal, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_61GoToLocal(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GoToLocal (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_60GoToLocal(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_60GoToLocal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GoToLocal", 0);

  /* "cPyUSBTMC.pyx":810
 * 
 *     def GoToLocal(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":811
 *     def GoToLocal(self):
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.GOTO_LOCAL,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cPyUSBTMC.pyx":812
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             USB488_REQUEST.GOTO_LOCAL,
 *             wValue= 0, # should I use struct? to avoide endianess
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":813
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.GOTO_LOCAL,             # <<<<<<<<<<<<<<
 *             wValue= 0, # should I use struct? to avoide endianess
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USB488_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_GOTO_LOCAL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":810
 * 
 *     def GoToLocal(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":814
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.GOTO_LOCAL,
 *             wValue= 0, # should I use struct? to avoide endianess             # <<<<<<<<<<<<<<
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0001,
 */
  __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wValue, __pyx_int_0) < 0) __PYX_ERR(0, 814, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 814, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_data_or_wLength, __pyx_int_1) < 0) __PYX_ERR(0, 814, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":817
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0001,
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         return b #USBTMC_Status
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":810
 * 
 *     def GoToLocal(self):
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":818
 *             data_or_wLength=0x0001,
 *             timeout=self.timeout)
 *         return b #USBTMC_Status             # <<<<<<<<<<<<<<
 * 
 *     def Read_Status_Byte(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":809
 *         return b #USBTMC_Status
 * 
 *     def GoToLocal(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.GoToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":820
 *         return b #USBTMC_Status
 * 
 *     def Read_Status_Byte(self):             # <<<<<<<<<<<<<<
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_63Read_Status_Byte(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_63Read_Status_Byte = {"Read_Status_Byte", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_63Read_Status_Byte, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_63Read_Status_Byte(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Read_Status_Byte (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_62Read_Status_Byte(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_62Read_Status_Byte(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_v_sb = NULL;
  PyObject *__pyx_v_bytes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Read_Status_Byte", 0);

  /* "cPyUSBTMC.pyx":822
 *     def Read_Status_Byte(self):
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ctrl_transfer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":823
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,             # <<<<<<<<<<<<<<
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.READ_STATUS_BYTE,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cPyUSBTMC.pyx":824
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type             # <<<<<<<<<<<<<<
 *             USB488_REQUEST.READ_STATUS_BYTE,
 *             wValue=bTag.next()&0x7f,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":825
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.READ_STATUS_BYTE,             # <<<<<<<<<<<<<<
 *             wValue=bTag.next()&0x7f,
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USB488_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_READ_STATUS_BYTE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":822
 *     def Read_Status_Byte(self):
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_9 = 0;

  /* "cPyUSBTMC.pyx":826
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 *             USB488_REQUEST.READ_STATUS_BYTE,
 *             wValue=bTag.next()&0x7f,             # <<<<<<<<<<<<<<
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0003,# USB2.0 specification, section 9.3.5
 */
  __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_bTag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_next); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_127, 0x7f, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wValue, __pyx_t_5) < 0) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_wIndex, __pyx_int_0) < 0) __PYX_ERR(0, 826, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_data_or_wLength, __pyx_int_3) < 0) __PYX_ERR(0, 826, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":829
 *             wIndex= 0, # Interface number (always zero for USBTMC)
 *             data_or_wLength=0x0003,# USB2.0 specification, section 9.3.5
 *             timeout=self.timeout)             # <<<<<<<<<<<<<<
 *         if self.intr_in:
 *             sb=USB488_Status(b)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_timeout, __pyx_t_5) < 0) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":822
 *     def Read_Status_Byte(self):
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(             # <<<<<<<<<<<<<<
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 *                                CTRL_RECIPIENT_INTERFACE), # bmRequest type
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_b = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":830
 *             data_or_wLength=0x0003,# USB2.0 specification, section 9.3.5
 *             timeout=self.timeout)
 *         if self.intr_in:             # <<<<<<<<<<<<<<
 *             sb=USB488_Status(b)
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_10) {

    /* "cPyUSBTMC.pyx":831
 *             timeout=self.timeout)
 *         if self.intr_in:
 *             sb=USB488_Status(b)             # <<<<<<<<<<<<<<
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)
 *             sb.SBR=Interrupt_IN_Data(bytes).SBR
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_USB488_Status); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_v_b) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_b);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_sb = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":832
 *         if self.intr_in:
 *             sb=USB488_Status(b)
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)             # <<<<<<<<<<<<<<
 *             sb.SBR=Interrupt_IN_Data(bytes).SBR
 *             return sb
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_wMaxPacketSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_intr_in); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_bInterval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_bytes = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cPyUSBTMC.pyx":833
 *             sb=USB488_Status(b)
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)
 *             sb.SBR=Interrupt_IN_Data(bytes).SBR             # <<<<<<<<<<<<<<
 *             return sb
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Interrupt_IN_Data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_bytes);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_SBR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_sb, __pyx_n_s_SBR, __pyx_t_3) < 0) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cPyUSBTMC.pyx":834
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)
 *             sb.SBR=Interrupt_IN_Data(bytes).SBR
 *             return sb             # <<<<<<<<<<<<<<
 *         else:
 *             return USB488_Status(b)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_sb);
    __pyx_r = __pyx_v_sb;
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":830
 *             data_or_wLength=0x0003,# USB2.0 specification, section 9.3.5
 *             timeout=self.timeout)
 *         if self.intr_in:             # <<<<<<<<<<<<<<
 *             sb=USB488_Status(b)
 *             bytes=self.intr_in.read(self.intr_in.wMaxPacketSize, self.intr_in.bInterval)
 */
  }

  /* "cPyUSBTMC.pyx":836
 *             return sb
 *         else:
 *             return USB488_Status(b)             # <<<<<<<<<<<<<<
 * 
 *     def TRIGGER(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_USB488_Status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_b) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_b);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cPyUSBTMC.pyx":820
 *         return b #USBTMC_Status
 * 
 *     def Read_Status_Byte(self):             # <<<<<<<<<<<<<<
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.Read_Status_Byte", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_sb);
  __Pyx_XDECREF(__pyx_v_bytes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":838
 *             return USB488_Status(b)
 * 
 *     def TRIGGER(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_65TRIGGER(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_65TRIGGER = {"TRIGGER", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_65TRIGGER, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_65TRIGGER(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("TRIGGER (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_64TRIGGER(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_64TRIGGER(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("TRIGGER", 0);

  /* "cPyUSBTMC.pyx":839
 * 
 *     def TRIGGER(self):
 *         if self.capabilities.DT1:             # <<<<<<<<<<<<<<
 *             btag,h=mkTriggerHeader()
 *             try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capabilities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DT1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":840
 *     def TRIGGER(self):
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()             # <<<<<<<<<<<<<<
 *             try:
 *                 self.bulk_out.write(h)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mkTriggerHeader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 840, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 840, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 840, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_btag = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_h = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":841
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(h)
 *                 self.last_write_bTag=btag
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "cPyUSBTMC.pyx":842
 *             btag,h=mkTriggerHeader()
 *             try:
 *                 self.bulk_out.write(h)             # <<<<<<<<<<<<<<
 *                 self.last_write_bTag=btag
 *             except:
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bulk_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 842, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && 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);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_h) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_h);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cPyUSBTMC.pyx":843
 *             try:
 *                 self.bulk_out.write(h)
 *                 self.last_write_bTag=btag             # <<<<<<<<<<<<<<
 *             except:
 *                 #self.abort_bulk_out() # is it reasonable?
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_last_write_bTag, __pyx_v_btag) < 0) __PYX_ERR(0, 843, __pyx_L6_error)

        /* "cPyUSBTMC.pyx":841
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(h)
 *                 self.last_write_bTag=btag
 */
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cPyUSBTMC.pyx":844
 *                 self.bulk_out.write(h)
 *                 self.last_write_bTag=btag
 *             except:             # <<<<<<<<<<<<<<
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")
 */
      /*except:*/ {
        __Pyx_AddTraceback("cPyUSBTMC.USB488_device.TRIGGER", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 844, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_4);

        /* "cPyUSBTMC.pyx":846
 *             except:
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")             # <<<<<<<<<<<<<<
 *                 raise
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_sys); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 846, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_stdout); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 846, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 846, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_n_s_aborting) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_n_s_aborting);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "cPyUSBTMC.pyx":847
 *                 #self.abort_bulk_out() # is it reasonable?
 *                 sys.stdout.write("aborting\n")
 *                 raise             # <<<<<<<<<<<<<<
 * 
 *     def GetExecuteTrigger(self):
 */
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_4);
        __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; 
        __PYX_ERR(0, 847, __pyx_L8_except_error)
      }
      __pyx_L8_except_error:;

      /* "cPyUSBTMC.pyx":841
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 *             try:             # <<<<<<<<<<<<<<
 *                 self.bulk_out.write(h)
 *                 self.last_write_bTag=btag
 */
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L11_try_end:;
    }

    /* "cPyUSBTMC.pyx":839
 * 
 *     def TRIGGER(self):
 *         if self.capabilities.DT1:             # <<<<<<<<<<<<<<
 *             btag,h=mkTriggerHeader()
 *             try:
 */
  }

  /* "cPyUSBTMC.pyx":838
 *             return USB488_Status(b)
 * 
 *     def TRIGGER(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.TRIGGER", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":849
 *                 raise
 * 
 *     def GetExecuteTrigger(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             self.TRIGGER()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_67GetExecuteTrigger(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_67GetExecuteTrigger = {"GetExecuteTrigger", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_67GetExecuteTrigger, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_67GetExecuteTrigger(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetExecuteTrigger (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_66GetExecuteTrigger(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_66GetExecuteTrigger(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetExecuteTrigger", 0);

  /* "cPyUSBTMC.pyx":850
 * 
 *     def GetExecuteTrigger(self):
 *         if self.capabilities.DT1:             # <<<<<<<<<<<<<<
 *             self.TRIGGER()
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capabilities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DT1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":851
 *     def GetExecuteTrigger(self):
 *         if self.capabilities.DT1:
 *             self.TRIGGER()             # <<<<<<<<<<<<<<
 *         else:
 *             self.TRG()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_TRIGGER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && 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);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":850
 * 
 *     def GetExecuteTrigger(self):
 *         if self.capabilities.DT1:             # <<<<<<<<<<<<<<
 *             self.TRIGGER()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":853
 *             self.TRIGGER()
 *         else:
 *             self.TRG()             # <<<<<<<<<<<<<<
 * 
 *     def SelectedDeviceClear(self):#table 26
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_TRG); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && 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);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":849
 *                 raise
 * 
 *     def GetExecuteTrigger(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             self.TRIGGER()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.GetExecuteTrigger", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":855
 *             self.TRG()
 * 
 *     def SelectedDeviceClear(self):#table 26             # <<<<<<<<<<<<<<
 *         self.clear()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_69SelectedDeviceClear(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_69SelectedDeviceClear = {"SelectedDeviceClear", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_69SelectedDeviceClear, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_69SelectedDeviceClear(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SelectedDeviceClear (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_68SelectedDeviceClear(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_68SelectedDeviceClear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SelectedDeviceClear", 0);

  /* "cPyUSBTMC.pyx":856
 * 
 *     def SelectedDeviceClear(self):#table 26
 *         self.clear()             # <<<<<<<<<<<<<<
 * 
 *     # @classmethod
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __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;

  /* "cPyUSBTMC.pyx":855
 *             self.TRG()
 * 
 *     def SelectedDeviceClear(self):#table 26             # <<<<<<<<<<<<<<
 *         self.clear()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.SelectedDeviceClear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":863
 *     #         ent.clear()
 * 
 *     def DCL(self):             # <<<<<<<<<<<<<<
 *         """
 *         send DCL(Device CLear)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_71DCL(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cPyUSBTMC_13USB488_device_70DCL[] = "\n        send DCL(Device CLear)\n        ";
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13USB488_device_71DCL = {"DCL", (PyCFunction)__pyx_pw_9cPyUSBTMC_13USB488_device_71DCL, METH_O, __pyx_doc_9cPyUSBTMC_13USB488_device_70DCL};
static PyObject *__pyx_pw_9cPyUSBTMC_13USB488_device_71DCL(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DCL (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_13USB488_device_70DCL(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_13USB488_device_70DCL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DCL", 0);

  /* "cPyUSBTMC.pyx":867
 *         send DCL(Device CLear)
 *         """
 *         self.write("*DCL\n")             # <<<<<<<<<<<<<<
 * 
 *     # @classmethod
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DCL) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DCL);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __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;

  /* "cPyUSBTMC.pyx":863
 *     #         ent.clear()
 * 
 *     def DCL(self):             # <<<<<<<<<<<<<<
 *         """
 *         send DCL(Device CLear)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USB488_device.DCL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":876
 * 
 * class USBTMC_Capabilities:
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_19USBTMC_Capabilities_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 876, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 876, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 876, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_Capabilities.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":877
 * class USBTMC_Capabilities:
 *     def __init__(self,bytes):
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])             # <<<<<<<<<<<<<<
 *         if (bytes[4]&0x4):
 *             self.indicator_pulse=True
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bytes, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_0x_2x_2x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bcdUSBTMC, __pyx_t_2) < 0) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":878
 *     def __init__(self,bytes):
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):             # <<<<<<<<<<<<<<
 *             self.indicator_pulse=True
 *         else:
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bytes, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_4, 0x4, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":879
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):
 *             self.indicator_pulse=True             # <<<<<<<<<<<<<<
 *         else:
 *             self.indicator_pulse=False
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_indicator_pulse, Py_True) < 0) __PYX_ERR(0, 879, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":878
 *     def __init__(self,bytes):
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):             # <<<<<<<<<<<<<<
 *             self.indicator_pulse=True
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":881
 *             self.indicator_pulse=True
 *         else:
 *             self.indicator_pulse=False             # <<<<<<<<<<<<<<
 * 
 *         if (bytes[4]&0x2):
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_indicator_pulse, Py_False) < 0) __PYX_ERR(0, 881, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":883
 *             self.indicator_pulse=False
 * 
 *         if (bytes[4]&0x2):             # <<<<<<<<<<<<<<
 *             self.talk_only=True
 *         else:
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_2, 0x2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":884
 * 
 *         if (bytes[4]&0x2):
 *             self.talk_only=True             # <<<<<<<<<<<<<<
 *         else:
 *             self.talk_only=False
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_talk_only, Py_True) < 0) __PYX_ERR(0, 884, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":883
 *             self.indicator_pulse=False
 * 
 *         if (bytes[4]&0x2):             # <<<<<<<<<<<<<<
 *             self.talk_only=True
 *         else:
 */
    goto __pyx_L4;
  }

  /* "cPyUSBTMC.pyx":886
 *             self.talk_only=True
 *         else:
 *             self.talk_only=False             # <<<<<<<<<<<<<<
 * 
 *         if (bytes[4]&0x1):
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_talk_only, Py_False) < 0) __PYX_ERR(0, 886, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "cPyUSBTMC.pyx":888
 *             self.talk_only=False
 * 
 *         if (bytes[4]&0x1):             # <<<<<<<<<<<<<<
 *             self.listen_only=True
 *         else:
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bytes, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":889
 * 
 *         if (bytes[4]&0x1):
 *             self.listen_only=True             # <<<<<<<<<<<<<<
 *         else:
 *             self.listen_only=False
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_listen_only, Py_True) < 0) __PYX_ERR(0, 889, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":888
 *             self.talk_only=False
 * 
 *         if (bytes[4]&0x1):             # <<<<<<<<<<<<<<
 *             self.listen_only=True
 *         else:
 */
    goto __pyx_L5;
  }

  /* "cPyUSBTMC.pyx":891
 *             self.listen_only=True
 *         else:
 *             self.listen_only=False             # <<<<<<<<<<<<<<
 *         if (bytes[5] &0x1):
 *             self.termchar_enable=True
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_listen_only, Py_False) < 0) __PYX_ERR(0, 891, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "cPyUSBTMC.pyx":892
 *         else:
 *             self.listen_only=False
 *         if (bytes[5] &0x1):             # <<<<<<<<<<<<<<
 *             self.termchar_enable=True
 *         else:
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":893
 *             self.listen_only=False
 *         if (bytes[5] &0x1):
 *             self.termchar_enable=True             # <<<<<<<<<<<<<<
 *         else:
 *             self.termchar_enable=False
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_termchar_enable, Py_True) < 0) __PYX_ERR(0, 893, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":892
 *         else:
 *             self.listen_only=False
 *         if (bytes[5] &0x1):             # <<<<<<<<<<<<<<
 *             self.termchar_enable=True
 *         else:
 */
    goto __pyx_L6;
  }

  /* "cPyUSBTMC.pyx":895
 *             self.termchar_enable=True
 *         else:
 *             self.termchar_enable=False             # <<<<<<<<<<<<<<
 *         if(len(bytes) > 12):
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_termchar_enable, Py_False) < 0) __PYX_ERR(0, 895, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "cPyUSBTMC.pyx":896
 *         else:
 *             self.termchar_enable=False
 *         if(len(bytes) > 12):             # <<<<<<<<<<<<<<
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 *             if bytes[14]&0x4:
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_bytes); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 896, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_5 > 12) != 0);
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":897
 *             self.termchar_enable=False
 *         if(len(bytes) > 12):
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])             # <<<<<<<<<<<<<<
 *             if bytes[14]&0x4:
 *                 self.USB488=True
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bytes, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_0x_2x_2x, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bcdUSB488, __pyx_t_3) < 0) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cPyUSBTMC.pyx":898
 *         if(len(bytes) > 12):
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 *             if bytes[14]&0x4:             # <<<<<<<<<<<<<<
 *                 self.USB488=True
 *             else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_4, 0x4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":899
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 *             if bytes[14]&0x4:
 *                 self.USB488=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.USB488=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_USB488, Py_True) < 0) __PYX_ERR(0, 899, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":898
 *         if(len(bytes) > 12):
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 *             if bytes[14]&0x4:             # <<<<<<<<<<<<<<
 *                 self.USB488=True
 *             else:
 */
      goto __pyx_L8;
    }

    /* "cPyUSBTMC.pyx":901
 *                 self.USB488=True
 *             else:
 *                 self.USB488=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[14]&0x2:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_USB488, Py_False) < 0) __PYX_ERR(0, 901, __pyx_L1_error)
    }
    __pyx_L8:;

    /* "cPyUSBTMC.pyx":903
 *                 self.USB488=False
 * 
 *             if bytes[14]&0x2:             # <<<<<<<<<<<<<<
 *                 self.REN_CONTROL=True
 *             else:
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_2, 0x2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 903, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":904
 * 
 *             if bytes[14]&0x2:
 *                 self.REN_CONTROL=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.REN_CONTROL=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_REN_CONTROL, Py_True) < 0) __PYX_ERR(0, 904, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":903
 *                 self.USB488=False
 * 
 *             if bytes[14]&0x2:             # <<<<<<<<<<<<<<
 *                 self.REN_CONTROL=True
 *             else:
 */
      goto __pyx_L9;
    }

    /* "cPyUSBTMC.pyx":906
 *                 self.REN_CONTROL=True
 *             else:
 *                 self.REN_CONTROL=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[14]&0x1:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_REN_CONTROL, Py_False) < 0) __PYX_ERR(0, 906, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "cPyUSBTMC.pyx":908
 *                 self.REN_CONTROL=False
 * 
 *             if bytes[14]&0x1:             # <<<<<<<<<<<<<<
 *                 self.TRIGGER=True
 *             else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 908, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":909
 * 
 *             if bytes[14]&0x1:
 *                 self.TRIGGER=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.TRIGGER=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TRIGGER, Py_True) < 0) __PYX_ERR(0, 909, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":908
 *                 self.REN_CONTROL=False
 * 
 *             if bytes[14]&0x1:             # <<<<<<<<<<<<<<
 *                 self.TRIGGER=True
 *             else:
 */
      goto __pyx_L10;
    }

    /* "cPyUSBTMC.pyx":911
 *                 self.TRIGGER=True
 *             else:
 *                 self.TRIGGER=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[15]&0x8:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TRIGGER, Py_False) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
    }
    __pyx_L10:;

    /* "cPyUSBTMC.pyx":913
 *                 self.TRIGGER=False
 * 
 *             if bytes[15]&0x8:             # <<<<<<<<<<<<<<
 *                 self.SCPI=True
 *             else:
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_8, 0x8, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 913, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":914
 * 
 *             if bytes[15]&0x8:
 *                 self.SCPI=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.SCPI=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SCPI, Py_True) < 0) __PYX_ERR(0, 914, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":913
 *                 self.TRIGGER=False
 * 
 *             if bytes[15]&0x8:             # <<<<<<<<<<<<<<
 *                 self.SCPI=True
 *             else:
 */
      goto __pyx_L11;
    }

    /* "cPyUSBTMC.pyx":916
 *                 self.SCPI=True
 *             else:
 *                 self.SCPI=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[15]&0x4:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SCPI, Py_False) < 0) __PYX_ERR(0, 916, __pyx_L1_error)
    }
    __pyx_L11:;

    /* "cPyUSBTMC.pyx":918
 *                 self.SCPI=False
 * 
 *             if bytes[15]&0x4:             # <<<<<<<<<<<<<<
 *                 self.SR1=True
 *             else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_4, 0x4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":919
 * 
 *             if bytes[15]&0x4:
 *                 self.SR1=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.SR1=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SR1, Py_True) < 0) __PYX_ERR(0, 919, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":918
 *                 self.SCPI=False
 * 
 *             if bytes[15]&0x4:             # <<<<<<<<<<<<<<
 *                 self.SR1=True
 *             else:
 */
      goto __pyx_L12;
    }

    /* "cPyUSBTMC.pyx":921
 *                 self.SR1=True
 *             else:
 *                 self.SR1=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[15]&0x2:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SR1, Py_False) < 0) __PYX_ERR(0, 921, __pyx_L1_error)
    }
    __pyx_L12:;

    /* "cPyUSBTMC.pyx":923
 *                 self.SR1=False
 * 
 *             if bytes[15]&0x2:             # <<<<<<<<<<<<<<
 *                 self.RL1=True
 *             else:
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_2, 0x2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":924
 * 
 *             if bytes[15]&0x2:
 *                 self.RL1=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.RL1=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_RL1, Py_True) < 0) __PYX_ERR(0, 924, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":923
 *                 self.SR1=False
 * 
 *             if bytes[15]&0x2:             # <<<<<<<<<<<<<<
 *                 self.RL1=True
 *             else:
 */
      goto __pyx_L13;
    }

    /* "cPyUSBTMC.pyx":926
 *                 self.RL1=True
 *             else:
 *                 self.RL1=False             # <<<<<<<<<<<<<<
 * 
 *             if bytes[15]&0x1:
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_RL1, Py_False) < 0) __PYX_ERR(0, 926, __pyx_L1_error)
    }
    __pyx_L13:;

    /* "cPyUSBTMC.pyx":928
 *                 self.RL1=False
 * 
 *             if bytes[15]&0x1:             # <<<<<<<<<<<<<<
 *                 self.DT1=True
 *             else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bytes, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":929
 * 
 *             if bytes[15]&0x1:
 *                 self.DT1=True             # <<<<<<<<<<<<<<
 *             else:
 *                 self.DT1=False
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_DT1, Py_True) < 0) __PYX_ERR(0, 929, __pyx_L1_error)

      /* "cPyUSBTMC.pyx":928
 *                 self.RL1=False
 * 
 *             if bytes[15]&0x1:             # <<<<<<<<<<<<<<
 *                 self.DT1=True
 *             else:
 */
      goto __pyx_L14;
    }

    /* "cPyUSBTMC.pyx":931
 *                 self.DT1=True
 *             else:
 *                 self.DT1=False             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    /*else*/ {
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_DT1, Py_False) < 0) __PYX_ERR(0, 931, __pyx_L1_error)
    }
    __pyx_L14:;

    /* "cPyUSBTMC.pyx":896
 *         else:
 *             self.termchar_enable=False
 *         if(len(bytes) > 12):             # <<<<<<<<<<<<<<
 *             self.bcdUSB488="0x%.2x%.2x"%(bytes[13],bytes[12])
 *             if bytes[14]&0x4:
 */
  }

  /* "cPyUSBTMC.pyx":876
 * 
 * class USBTMC_Capabilities:
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_Capabilities.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":933
 *                 self.DT1=False
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         msg=""
 *         if self.indicator_pulse:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_19USBTMC_Capabilities_3__str__ = {"__str__", (PyCFunction)__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_3__str__, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_19USBTMC_Capabilities_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_9cPyUSBTMC_19USBTMC_Capabilities_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cPyUSBTMC.pyx":934
 * 
 *     def __str__(self):
 *         msg=""             # <<<<<<<<<<<<<<
 *         if self.indicator_pulse:
 *             msg +="indicator pulse,"
 */
  __Pyx_INCREF(__pyx_kp_s__3);
  __pyx_v_msg = __pyx_kp_s__3;

  /* "cPyUSBTMC.pyx":935
 *     def __str__(self):
 *         msg=""
 *         if self.indicator_pulse:             # <<<<<<<<<<<<<<
 *             msg +="indicator pulse,"
 *         if self.talk_only:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_indicator_pulse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":936
 *         msg=""
 *         if self.indicator_pulse:
 *             msg +="indicator pulse,"             # <<<<<<<<<<<<<<
 *         if self.talk_only:
 *             msg +="talk only,"
 */
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_kp_s_indicator_pulse_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":935
 *     def __str__(self):
 *         msg=""
 *         if self.indicator_pulse:             # <<<<<<<<<<<<<<
 *             msg +="indicator pulse,"
 *         if self.talk_only:
 */
  }

  /* "cPyUSBTMC.pyx":937
 *         if self.indicator_pulse:
 *             msg +="indicator pulse,"
 *         if self.talk_only:             # <<<<<<<<<<<<<<
 *             msg +="talk only,"
 *         if self.listen_only:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_talk_only); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":938
 *             msg +="indicator pulse,"
 *         if self.talk_only:
 *             msg +="talk only,"             # <<<<<<<<<<<<<<
 *         if self.listen_only:
 *             msg +="listen only,"
 */
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_kp_s_talk_only_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":937
 *         if self.indicator_pulse:
 *             msg +="indicator pulse,"
 *         if self.talk_only:             # <<<<<<<<<<<<<<
 *             msg +="talk only,"
 *         if self.listen_only:
 */
  }

  /* "cPyUSBTMC.pyx":939
 *         if self.talk_only:
 *             msg +="talk only,"
 *         if self.listen_only:             # <<<<<<<<<<<<<<
 *             msg +="listen only,"
 *         if self.termchar_enable:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listen_only); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":940
 *             msg +="talk only,"
 *         if self.listen_only:
 *             msg +="listen only,"             # <<<<<<<<<<<<<<
 *         if self.termchar_enable:
 *             msg +="termchar enable"
 */
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_kp_s_listen_only_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":939
 *         if self.talk_only:
 *             msg +="talk only,"
 *         if self.listen_only:             # <<<<<<<<<<<<<<
 *             msg +="listen only,"
 *         if self.termchar_enable:
 */
  }

  /* "cPyUSBTMC.pyx":941
 *         if self.listen_only:
 *             msg +="listen only,"
 *         if self.termchar_enable:             # <<<<<<<<<<<<<<
 *             msg +="termchar enable"
 *         return msg
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_termchar_enable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cPyUSBTMC.pyx":942
 *             msg +="listen only,"
 *         if self.termchar_enable:
 *             msg +="termchar enable"             # <<<<<<<<<<<<<<
 *         return msg
 * 
 */
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_kp_s_termchar_enable_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":941
 *         if self.listen_only:
 *             msg +="listen only,"
 *         if self.termchar_enable:             # <<<<<<<<<<<<<<
 *             msg +="termchar enable"
 *         return msg
 */
  }

  /* "cPyUSBTMC.pyx":943
 *         if self.termchar_enable:
 *             msg +="termchar enable"
 *         return msg             # <<<<<<<<<<<<<<
 * 
 * # bTag generator
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":933
 *                 self.DT1=False
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         msg=""
 *         if self.indicator_pulse:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cPyUSBTMC.USBTMC_Capabilities.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":949
 *     __lastbtag=0
 *     @classmethod
 *     def next(cls):             # <<<<<<<<<<<<<<
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_4bTag_1next(PyObject *__pyx_self, PyObject *__pyx_v_cls); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_4bTag_1next = {"next", (PyCFunction)__pyx_pw_9cPyUSBTMC_4bTag_1next, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_4bTag_1next(PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_4bTag_next(__pyx_self, ((PyObject *)__pyx_v_cls));

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

static PyObject *__pyx_pf_9cPyUSBTMC_4bTag_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("next", 0);

  /* "cPyUSBTMC.pyx":951
 *     def next(cls):
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)             # <<<<<<<<<<<<<<
 *         return cls.__lastbtag
 *     @classmethod
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_bTag__lastbtag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_255, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":950
 *     @classmethod
 *     def next(cls):
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff             # <<<<<<<<<<<<<<
 *                          if (cls.__lastbtag < 0xff) else 1)
 *         return cls.__lastbtag
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_bTag__lastbtag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_1);
    __pyx_t_1 = __pyx_int_1;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_bTag__lastbtag, __pyx_t_1) < 0) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":952
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)
 *         return cls.__lastbtag             # <<<<<<<<<<<<<<
 *     @classmethod
 *     def last(cls):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_bTag__lastbtag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":949
 *     __lastbtag=0
 *     @classmethod
 *     def next(cls):             # <<<<<<<<<<<<<<
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.bTag.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":954
 *         return cls.__lastbtag
 *     @classmethod
 *     def last(cls):             # <<<<<<<<<<<<<<
 *         return cls.__lastbtag
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_4bTag_3last(PyObject *__pyx_self, PyObject *__pyx_v_cls); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_4bTag_3last = {"last", (PyCFunction)__pyx_pw_9cPyUSBTMC_4bTag_3last, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_4bTag_3last(PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("last (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_4bTag_2last(__pyx_self, ((PyObject *)__pyx_v_cls));

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

static PyObject *__pyx_pf_9cPyUSBTMC_4bTag_2last(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("last", 0);

  /* "cPyUSBTMC.pyx":955
 *     @classmethod
 *     def last(cls):
 *         return cls.__lastbtag             # <<<<<<<<<<<<<<
 * 
 * def mkCommonHeader(msgid):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_bTag__lastbtag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":954
 *         return cls.__lastbtag
 *     @classmethod
 *     def last(cls):             # <<<<<<<<<<<<<<
 *         return cls.__lastbtag
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cPyUSBTMC.bTag.last", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":957
 *         return cls.__lastbtag
 * 
 * def mkCommonHeader(msgid):             # <<<<<<<<<<<<<<
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_3mkCommonHeader(PyObject *__pyx_self, PyObject *__pyx_v_msgid); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_3mkCommonHeader = {"mkCommonHeader", (PyCFunction)__pyx_pw_9cPyUSBTMC_3mkCommonHeader, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_3mkCommonHeader(PyObject *__pyx_self, PyObject *__pyx_v_msgid) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkCommonHeader (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_2mkCommonHeader(__pyx_self, ((PyObject *)__pyx_v_msgid));

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

static PyObject *__pyx_pf_9cPyUSBTMC_2mkCommonHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_msgid) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkCommonHeader", 0);

  /* "cPyUSBTMC.pyx":958
 * 
 * def mkCommonHeader(msgid):
 *     btag=bTag.next()             # <<<<<<<<<<<<<<
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 *     return (btag,h)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bTag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_next); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_btag = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":959
 * def mkCommonHeader(msgid):
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.             # <<<<<<<<<<<<<<
 *     return (btag,h)
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_msgid, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Invert(__pyx_v_btag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_btag);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_1c_1c_1c, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_h = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":960
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_h);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":957
 *         return cls.__lastbtag
 * 
 * def mkCommonHeader(msgid):             # <<<<<<<<<<<<<<
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cPyUSBTMC.mkCommonHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":963
 * 
 * 
 * def mkTriggerHeader():             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_5mkTriggerHeader(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_5mkTriggerHeader = {"mkTriggerHeader", (PyCFunction)__pyx_pw_9cPyUSBTMC_5mkTriggerHeader, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_5mkTriggerHeader(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkTriggerHeader (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_4mkTriggerHeader(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_4mkTriggerHeader(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkTriggerHeader", 0);

  /* "cPyUSBTMC.pyx":964
 * 
 * def mkTriggerHeader():
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)             # <<<<<<<<<<<<<<
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 *     return (btag,h)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkCommonHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_TRIGGER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 964, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 964, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 964, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":965
 * def mkTriggerHeader():
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)             # <<<<<<<<<<<<<<
 *     return (btag,h)
 * 
 */
  __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s, __pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":966
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_h);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":963
 * 
 * 
 * def mkTriggerHeader():             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.mkTriggerHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":968
 *     return (btag,h)
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_7mkDevDepMSGOUTHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_7mkDevDepMSGOUTHeader = {"mkDevDepMSGOUTHeader", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_7mkDevDepMSGOUTHeader, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_7mkDevDepMSGOUTHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tsize = 0;
  PyObject *__pyx_v_eom = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkDevDepMSGOUTHeader (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tsize,&__pyx_n_s_eom,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eom);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mkDevDepMSGOUTHeader") < 0)) __PYX_ERR(0, 968, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tsize = values[0];
    __pyx_v_eom = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mkDevDepMSGOUTHeader", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 968, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.mkDevDepMSGOUTHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_6mkDevDepMSGOUTHeader(__pyx_self, __pyx_v_tsize, __pyx_v_eom);

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

static PyObject *__pyx_pf_9cPyUSBTMC_6mkDevDepMSGOUTHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize, PyObject *__pyx_v_eom) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkDevDepMSGOUTHeader", 0);

  /* "cPyUSBTMC.pyx":969
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)             # <<<<<<<<<<<<<<
 *     if eom:
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkCommonHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DEV_DEP_MSG_OUT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 969, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 969, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 969, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":970
 * def mkDevDepMSGOUTHeader(tsize, eom=False):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:             # <<<<<<<<<<<<<<
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,
 *                                     tsize & 0xff,
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_eom); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 970, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "cPyUSBTMC.pyx":972
 *     if eom:
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,
 *                                     tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,
 */
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cPyUSBTMC.pyx":973
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>16) & 0xff,
 *                                     (tsize>>24) & 0xff)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":974
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>24) & 0xff)
 *     else:
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":975
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,
 *                                     (tsize>>24) & 0xff)             # <<<<<<<<<<<<<<
 *     else:
 *         h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":971
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_7);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cPyUSBTMC.pyx":970
 * def mkDevDepMSGOUTHeader(tsize, eom=False):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:             # <<<<<<<<<<<<<<
 *         h="%s%1c%1c%1c%1c\1\0\0\0"%(h,
 *                                     tsize & 0xff,
 */
    goto __pyx_L5;
  }

  /* "cPyUSBTMC.pyx":977
 *                                     (tsize>>24) & 0xff)
 *     else:
 *         h="%s%1c%1c%1c%1c\0\0\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,
 */
  /*else*/ {

    /* "cPyUSBTMC.pyx":978
 *     else:
 *         h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                     tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,
 */
    __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "cPyUSBTMC.pyx":979
 *         h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>16) & 0xff,
 *                                     (tsize>>24) & 0xff)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":980
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                     (tsize>>24) & 0xff)
 *     return (btag,h)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":981
 *                                     (tsize>>8) & 0xff,
 *                                     (tsize>>16) & 0xff,
 *                                     (tsize>>24) & 0xff)             # <<<<<<<<<<<<<<
 *     return (btag,h)
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":977
 *                                     (tsize>>24) & 0xff)
 *     else:
 *         h="%s%1c%1c%1c%1c\0\0\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                     tsize & 0xff,
 *                                     (tsize>>8) & 0xff,
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_1);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "cPyUSBTMC.pyx":982
 *                                     (tsize>>16) & 0xff,
 *                                     (tsize>>24) & 0xff)
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_h);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":968
 *     return (btag,h)
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:
 */

  /* 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_7);
  __Pyx_AddTraceback("cPyUSBTMC.mkDevDepMSGOUTHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":984
 *     return (btag,h)
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_9mkReqDevDepMSGINHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_9mkReqDevDepMSGINHeader = {"mkReqDevDepMSGINHeader", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_9mkReqDevDepMSGINHeader, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_9mkReqDevDepMSGINHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tsize = 0;
  PyObject *__pyx_v_TermCharEnable = 0;
  PyObject *__pyx_v_TermChar = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkReqDevDepMSGINHeader (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tsize,&__pyx_n_s_TermCharEnable,&__pyx_n_s_TermChar,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)__pyx_kp_s__4);
    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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_TermCharEnable)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mkReqDevDepMSGINHeader", 0, 2, 3, 1); __PYX_ERR(0, 984, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_TermChar);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mkReqDevDepMSGINHeader") < 0)) __PYX_ERR(0, 984, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tsize = values[0];
    __pyx_v_TermCharEnable = values[1];
    __pyx_v_TermChar = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mkReqDevDepMSGINHeader", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 984, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.mkReqDevDepMSGINHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_8mkReqDevDepMSGINHeader(__pyx_self, __pyx_v_tsize, __pyx_v_TermCharEnable, __pyx_v_TermChar);

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

static PyObject *__pyx_pf_9cPyUSBTMC_8mkReqDevDepMSGINHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize, PyObject *__pyx_v_TermCharEnable, PyObject *__pyx_v_TermChar) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkReqDevDepMSGINHeader", 0);

  /* "cPyUSBTMC.pyx":985
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)             # <<<<<<<<<<<<<<
 *     if TermCharEnable:
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkCommonHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DEV_DEP_MSG_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 985, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 985, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 985, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":986
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:             # <<<<<<<<<<<<<<
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,
 *                                      tsize & 0xff,
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_TermCharEnable); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 986, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "cPyUSBTMC.pyx":988
 *     if TermCharEnable:
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,
 *                                      tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,
 */
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cPyUSBTMC.pyx":989
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>16) & 0xff,
 *                                      (tsize>>24) & 0xff,
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":990
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>24) & 0xff,
 *                                      TermChar)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":991
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,
 *                                      (tsize>>24) & 0xff,             # <<<<<<<<<<<<<<
 *                                      TermChar)
 *     else:
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":987
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,
 */
    __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_TermChar);
    __Pyx_GIVEREF(__pyx_v_TermChar);
    PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_TermChar);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c_1c, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cPyUSBTMC.pyx":986
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:             # <<<<<<<<<<<<<<
 *         h="%s%1c%1c%1c%1c\2%1c\0\0"%(h,
 *                                      tsize & 0xff,
 */
    goto __pyx_L5;
  }

  /* "cPyUSBTMC.pyx":994
 *                                      TermChar)
 *     else:
 *         h="%s%1c%1c%1c%1c\0%1c\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,
 */
  /*else*/ {

    /* "cPyUSBTMC.pyx":995
 *     else:
 *         h="%s%1c%1c%1c%1c\0%1c\0\0"%(h,
 *                                      tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,
 */
    __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "cPyUSBTMC.pyx":996
 *         h="%s%1c%1c%1c%1c\0%1c\0\0"%(h,
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>16) & 0xff,
 *                                      (tsize>>24) & 0xff,
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":997
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                      (tsize>>24) & 0xff,
 *                                      TermChar)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":998
 *                                      (tsize>>8) & 0xff,
 *                                      (tsize>>16) & 0xff,
 *                                      (tsize>>24) & 0xff,             # <<<<<<<<<<<<<<
 *                                      TermChar)
 *     return (btag,h)
 */
    __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cPyUSBTMC.pyx":994
 *                                      TermChar)
 *     else:
 *         h="%s%1c%1c%1c%1c\0%1c\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                      tsize & 0xff,
 *                                      (tsize>>8) & 0xff,
 */
    __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_TermChar);
    __Pyx_GIVEREF(__pyx_v_TermChar);
    PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_TermChar);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c_1c_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "cPyUSBTMC.pyx":1000
 *                                      (tsize>>24) & 0xff,
 *                                      TermChar)
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_h);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":984
 *     return (btag,h)
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:
 */

  /* 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_7);
  __Pyx_AddTraceback("cPyUSBTMC.mkReqDevDepMSGINHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1003
 * 
 * 
 * def mkVendorSpecMSGOUTHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_11mkVendorSpecMSGOUTHeader(PyObject *__pyx_self, PyObject *__pyx_v_tsize); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_11mkVendorSpecMSGOUTHeader = {"mkVendorSpecMSGOUTHeader", (PyCFunction)__pyx_pw_9cPyUSBTMC_11mkVendorSpecMSGOUTHeader, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_11mkVendorSpecMSGOUTHeader(PyObject *__pyx_self, PyObject *__pyx_v_tsize) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkVendorSpecMSGOUTHeader (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_10mkVendorSpecMSGOUTHeader(__pyx_self, ((PyObject *)__pyx_v_tsize));

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

static PyObject *__pyx_pf_9cPyUSBTMC_10mkVendorSpecMSGOUTHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkVendorSpecMSGOUTHeader", 0);

  /* "cPyUSBTMC.pyx":1004
 * 
 * def mkVendorSpecMSGOUTHeader(tsize):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)             # <<<<<<<<<<<<<<
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkCommonHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_VENDOR_SPECIFIC_OUT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1004, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1004, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1004, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1006
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":1007
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>16) & 0xff,
 *                                 (tsize>>24) & 0xff
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1008
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>24) & 0xff
 *                                 )
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1009
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,
 *                                 (tsize>>24) & 0xff             # <<<<<<<<<<<<<<
 *                                 )
 *     return (btag,h)
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1005
 * def mkVendorSpecMSGOUTHeader(tsize):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,
 */
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1011
 *                                 (tsize>>24) & 0xff
 *                                 )
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_h);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1003
 * 
 * 
 * def mkVendorSpecMSGOUTHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */

  /* 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("cPyUSBTMC.mkVendorSpecMSGOUTHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1013
 *     return (btag,h)
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13mkReqVendorSpecMSGINHeader(PyObject *__pyx_self, PyObject *__pyx_v_tsize); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13mkReqVendorSpecMSGINHeader = {"mkReqVendorSpecMSGINHeader", (PyCFunction)__pyx_pw_9cPyUSBTMC_13mkReqVendorSpecMSGINHeader, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13mkReqVendorSpecMSGINHeader(PyObject *__pyx_self, PyObject *__pyx_v_tsize) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mkReqVendorSpecMSGINHeader (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_12mkReqVendorSpecMSGINHeader(__pyx_self, ((PyObject *)__pyx_v_tsize));

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

static PyObject *__pyx_pf_9cPyUSBTMC_12mkReqVendorSpecMSGINHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tsize) {
  PyObject *__pyx_v_btag = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mkReqVendorSpecMSGINHeader", 0);

  /* "cPyUSBTMC.pyx":1014
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)             # <<<<<<<<<<<<<<
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mkCommonHeader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_VENDOR_SPECIFIC_IN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1014, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1014, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1014, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_btag = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1016
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,
 */
  __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_v_tsize, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":1017
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>16) & 0xff,
 *                                 (tsize>>24) & 0xff
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1018
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,             # <<<<<<<<<<<<<<
 *                                 (tsize>>24) & 0xff
 *                                 )
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1019
 *                                 (tsize>>8) & 0xff,
 *                                 (tsize>>16) & 0xff,
 *                                 (tsize>>24) & 0xff             # <<<<<<<<<<<<<<
 *                                 )
 *     return (btag,h)
 */
  __pyx_t_4 = __Pyx_PyInt_RshiftObjC(__pyx_v_tsize, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_255, 0xff, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":1015
 * def mkReqVendorSpecMSGINHeader(tsize):
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,             # <<<<<<<<<<<<<<
 *                                 tsize & 0xff,
 *                                 (tsize>>8) & 0xff,
 */
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_1c_1c_1c_1c_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1021
 *                                 (tsize>>24) & 0xff
 *                                 )
 *     return (btag,h)             # <<<<<<<<<<<<<<
 * 
 * class BulkIn_Header:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_btag);
  __Pyx_GIVEREF(__pyx_v_btag);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_btag);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_h);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1013
 *     return (btag,h)
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */

  /* 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("cPyUSBTMC.mkReqVendorSpecMSGINHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_btag);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1027
 *     convert return value header to structure
 *     """
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_13BulkIn_Header_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_13BulkIn_Header_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_13BulkIn_Header_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_13BulkIn_Header_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1027, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1027, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1027, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.BulkIn_Header.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_13BulkIn_Header___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_13BulkIn_Header___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":1028
 *     """
 *     def __init__(self,bytes):
 *         self.msgID=bytes[0]             # <<<<<<<<<<<<<<
 *         self.bTag=bytes[1]
 *         self.bTagInverse=bytes[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_msgID, __pyx_t_1) < 0) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1029
 *     def __init__(self,bytes):
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]             # <<<<<<<<<<<<<<
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bTag, __pyx_t_1) < 0) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1030
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]
 *         self.bTagInverse=bytes[2]             # <<<<<<<<<<<<<<
 *         self.resMsg=bytes[4:12]
 *         try:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bTagInverse, __pyx_t_1) < 0) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1031
 *         self.bTag=bytes[1]
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]             # <<<<<<<<<<<<<<
 *         try:
 *             self.data=bytes[12:]
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_bytes, 4, 12, NULL, NULL, &__pyx_slice__6, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_resMsg, __pyx_t_1) < 0) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1032
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]
 *         try:             # <<<<<<<<<<<<<<
 *             self.data=bytes[12:]
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "cPyUSBTMC.pyx":1033
 *         self.resMsg=bytes[4:12]
 *         try:
 *             self.data=bytes[12:]             # <<<<<<<<<<<<<<
 *         except:
 *             self.data=None
 */
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_bytes, 12, 0, NULL, NULL, &__pyx_slice__7, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1033, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 1033, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cPyUSBTMC.pyx":1032
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]
 *         try:             # <<<<<<<<<<<<<<
 *             self.data=bytes[12:]
 *         except:
 */
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":1034
 *         try:
 *             self.data=bytes[12:]
 *         except:             # <<<<<<<<<<<<<<
 *             self.data=None
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("cPyUSBTMC.BulkIn_Header.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1034, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "cPyUSBTMC.pyx":1035
 *             self.data=bytes[12:]
 *         except:
 *             self.data=None             # <<<<<<<<<<<<<<
 * 
 * class DevDep_Responce(BulkIn_Header):
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data, Py_None) < 0) __PYX_ERR(0, 1035, __pyx_L5_except_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;

    /* "cPyUSBTMC.pyx":1032
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]
 *         try:             # <<<<<<<<<<<<<<
 *             self.data=bytes[12:]
 *         except:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L8_try_end:;
  }

  /* "cPyUSBTMC.pyx":1027
 *     convert return value header to structure
 *     """
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cPyUSBTMC.BulkIn_Header.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1038
 * 
 * class DevDep_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_15DevDep_Responce_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_15DevDep_Responce_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_15DevDep_Responce_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_15DevDep_Responce_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1038, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1038, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1038, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.DevDep_Responce.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_15DevDep_Responce___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_15DevDep_Responce___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":1039
 * class DevDep_Responce(BulkIn_Header):
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)             # <<<<<<<<<<<<<<
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 *             raise TypeError
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BulkIn_Header); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && 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);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_bytes};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_bytes};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_bytes);
    __Pyx_GIVEREF(__pyx_v_bytes);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_bytes);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1040
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :             # <<<<<<<<<<<<<<
 *             raise TypeError
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_msgID); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DEV_DEP_MSG_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_6)) {

    /* "cPyUSBTMC.pyx":1041
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 *             raise TypeError             # <<<<<<<<<<<<<<
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(0, 1041, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":1040
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :             # <<<<<<<<<<<<<<
 *             raise TypeError
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 */
  }

  /* "cPyUSBTMC.pyx":1043
 *             raise TypeError
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1044
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_1, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1043
 *             raise TypeError
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1045
 *         self.TransferSize = ( self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[3]<<24))
 *         self.TermChar=(self.resMsg[4]>>1)&0x1
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_5, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1044
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))
 */
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1046
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))             # <<<<<<<<<<<<<<
 *         self.TermChar=(self.resMsg[4]>>1)&0x1
 *         self.eom=self.resMsg[4]&0x1
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_1, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1045
 *         self.TransferSize = ( self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[3]<<24))
 *         self.TermChar=(self.resMsg[4]>>1)&0x1
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1043
 *             raise TypeError
 *         #self.TransferSize=struct.unpack("<l",self.resMsg[:4])[0]
 *         self.TransferSize = ( self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TransferSize, __pyx_t_1) < 0) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1047
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))
 *         self.TermChar=(self.resMsg[4]>>1)&0x1             # <<<<<<<<<<<<<<
 *         self.eom=self.resMsg[4]&0x1
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_RshiftObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TermChar, __pyx_t_3) < 0) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1048
 *                              (self.resMsg[3]<<24))
 *         self.TermChar=(self.resMsg[4]>>1)&0x1
 *         self.eom=self.resMsg[4]&0x1             # <<<<<<<<<<<<<<
 * 
 * class VendorSpec_Responce(BulkIn_Header):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_1, 0x1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_eom, __pyx_t_3) < 0) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1038
 * 
 * class DevDep_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cPyUSBTMC.DevDep_Responce.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1051
 * 
 * class VendorSpec_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_19VendorSpec_Responce_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_19VendorSpec_Responce_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_19VendorSpec_Responce_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_19VendorSpec_Responce_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1051, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1051, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1051, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.VendorSpec_Responce.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_19VendorSpec_Responce___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_19VendorSpec_Responce___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":1052
 * class VendorSpec_Responce(BulkIn_Header):
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)             # <<<<<<<<<<<<<<
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 *             raise TypeError
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BulkIn_Header); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && 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);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_bytes};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_bytes};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_bytes);
    __Pyx_GIVEREF(__pyx_v_bytes);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_bytes);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1053
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :             # <<<<<<<<<<<<<<
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_msgID); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_MsgID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_VENDOR_SPECIFIC_IN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_6)) {

    /* "cPyUSBTMC.pyx":1054
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 *             raise TypeError             # <<<<<<<<<<<<<<
 *         self.TransferSize = (self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(0, 1054, __pyx_L1_error)

    /* "cPyUSBTMC.pyx":1053
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :             # <<<<<<<<<<<<<<
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+
 */
  }

  /* "cPyUSBTMC.pyx":1055
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1056
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_1, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1055
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1057
 *         self.TransferSize = (self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[3]<<24))
 * #
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_5, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1056
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))
 */
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1058
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 *                              (self.resMsg[3]<<24))             # <<<<<<<<<<<<<<
 * #
 * class Interrupt_IN_Data:# Table 6, USB488
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_resMsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_LshiftObjC(__pyx_t_1, __pyx_int_24, 24, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1057
 *         self.TransferSize = (self.resMsg[0]+
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[3]<<24))
 * #
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1055
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 *             raise TypeError
 *         self.TransferSize = (self.resMsg[0]+             # <<<<<<<<<<<<<<
 *                              (self.resMsg[1]<<8)+
 *                              (self.resMsg[2]<<16)+
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_TransferSize, __pyx_t_1) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1051
 * 
 * class VendorSpec_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cPyUSBTMC.VendorSpec_Responce.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1061
 * #
 * class Interrupt_IN_Data:# Table 6, USB488
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.SBR=None
 *         self.statusBytes=None
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_17Interrupt_IN_Data_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_17Interrupt_IN_Data_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_17Interrupt_IN_Data_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_17Interrupt_IN_Data_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1061, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1061, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1061, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.Interrupt_IN_Data.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_17Interrupt_IN_Data___init__(__pyx_self, __pyx_v_self, __pyx_v_bytes);

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

static PyObject *__pyx_pf_9cPyUSBTMC_17Interrupt_IN_Data___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cPyUSBTMC.pyx":1062
 * class Interrupt_IN_Data:# Table 6, USB488
 *     def __init__(self, bytes):
 *         self.SBR=None             # <<<<<<<<<<<<<<
 *         self.statusBytes=None
 *         if (bytes[0] & 0x80):# USB488
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SBR, Py_None) < 0) __PYX_ERR(0, 1062, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1063
 *     def __init__(self, bytes):
 *         self.SBR=None
 *         self.statusBytes=None             # <<<<<<<<<<<<<<
 *         if (bytes[0] & 0x80):# USB488
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_statusBytes, Py_None) < 0) __PYX_ERR(0, 1063, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1064
 *         self.SBR=None
 *         self.statusBytes=None
 *         if (bytes[0] & 0x80):# USB488             # <<<<<<<<<<<<<<
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_128, 0x80, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":1065
 *         self.statusBytes=None
 *         if (bytes[0] & 0x80):# USB488
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status             # <<<<<<<<<<<<<<
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 *         elif (bytes[0] & 0x40): # vendor specific
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bytes, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_127, 0x7f, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bTag, __pyx_t_1) < 0) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":1066
 *         if (bytes[0] & 0x80):# USB488
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])             # <<<<<<<<<<<<<<
 *         elif (bytes[0] & 0x40): # vendor specific
 *             self.statusBytes=bytes[1:]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IEEE488_Status_Byte_Reg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_bytes, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_SBR, __pyx_t_1) < 0) __PYX_ERR(0, 1066, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":1064
 *         self.SBR=None
 *         self.statusBytes=None
 *         if (bytes[0] & 0x80):# USB488             # <<<<<<<<<<<<<<
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":1067
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 *         elif (bytes[0] & 0x40): # vendor specific             # <<<<<<<<<<<<<<
 *             self.statusBytes=bytes[1:]
 *         else:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bytes, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_64, 0x40, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":1068
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 *         elif (bytes[0] & 0x40): # vendor specific
 *             self.statusBytes=bytes[1:]             # <<<<<<<<<<<<<<
 *         else:
 *             self.statusBytes=bytes[1:]
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_bytes, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_statusBytes, __pyx_t_2) < 0) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cPyUSBTMC.pyx":1067
 *             self.bTag=bytes[0]&0x7f # 0x01 for SRQ responce or bTag_id for READ_Status
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 *         elif (bytes[0] & 0x40): # vendor specific             # <<<<<<<<<<<<<<
 *             self.statusBytes=bytes[1:]
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cPyUSBTMC.pyx":1070
 *             self.statusBytes=bytes[1:]
 *         else:
 *             self.statusBytes=bytes[1:]             # <<<<<<<<<<<<<<
 * #
 * def test():
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_bytes, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_statusBytes, __pyx_t_2) < 0) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "cPyUSBTMC.pyx":1061
 * #
 * class Interrupt_IN_Data:# Table 6, USB488
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.SBR=None
 *         self.statusBytes=None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cPyUSBTMC.Interrupt_IN_Data.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1072
 *             self.statusBytes=bytes[1:]
 * #
 * def test():             # <<<<<<<<<<<<<<
 *     #import usb.core, usb.util,usb.backend,usb.backend.libusb1
 *     #dev=usb.core.find(idVendor=0x0957, idProduct=0x0407)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_15test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_15test = {"test", (PyCFunction)__pyx_pw_9cPyUSBTMC_15test, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_15test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_14test(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_14test(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_usbdevs = NULL;
  PyObject *__pyx_v_usbdev = NULL;
  PyObject *__pyx_v_tmcdev = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test", 0);

  /* "cPyUSBTMC.pyx":1083
 *     # dev=usb.core.find(idVendor=0x0699 # Tektronix
 *     #, idProduct=0x0347) #AFG3022 address 0x1,0x82,0x83
 *     usbdevs=find_tmc_devices() #             # <<<<<<<<<<<<<<
 *     if usbdevs == None:
 *         return
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_find_tmc_devices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_usbdevs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1084
 *     #, idProduct=0x0347) #AFG3022 address 0x1,0x82,0x83
 *     usbdevs=find_tmc_devices() #
 *     if usbdevs == None:             # <<<<<<<<<<<<<<
 *         return
 *     usbdev=usbdevs.next()
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_usbdevs, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":1085
 *     usbdevs=find_tmc_devices() #
 *     if usbdevs == None:
 *         return             # <<<<<<<<<<<<<<
 *     usbdev=usbdevs.next()
 *     #tmcdev=USBTMC_device(dev)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":1084
 *     #, idProduct=0x0347) #AFG3022 address 0x1,0x82,0x83
 *     usbdevs=find_tmc_devices() #
 *     if usbdevs == None:             # <<<<<<<<<<<<<<
 *         return
 *     usbdev=usbdevs.next()
 */
  }

  /* "cPyUSBTMC.pyx":1086
 *     if usbdevs == None:
 *         return
 *     usbdev=usbdevs.next()             # <<<<<<<<<<<<<<
 *     #tmcdev=USBTMC_device(dev)
 *     tmcdev=USB488_device(usbdev)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_usbdevs, __pyx_n_s_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_usbdev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1088
 *     usbdev=usbdevs.next()
 *     #tmcdev=USBTMC_device(dev)
 *     tmcdev=USB488_device(usbdev)             # <<<<<<<<<<<<<<
 *     #print "Clear:",tmcdev.clear()
 *     #print "ClearStatsu:",tmcdev.check_clear_status()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USB488_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_usbdev) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_usbdev);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tmcdev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1091
 *     #print "Clear:",tmcdev.clear()
 *     #print "ClearStatsu:",tmcdev.check_clear_status()
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             tmcdev.device_write("*IDN?\n")
 */
  /*try:*/ {

    /* "cPyUSBTMC.pyx":1092
 *     #print "ClearStatsu:",tmcdev.check_clear_status()
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             tmcdev.device_write("*IDN?\n")
 *         except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "cPyUSBTMC.pyx":1093
 *     try:
 *         try:
 *             tmcdev.device_write("*IDN?\n")             # <<<<<<<<<<<<<<
 *         except:
 *             tmcdev.abort_bulk_out()
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_IDN) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_IDN);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cPyUSBTMC.pyx":1092
 *     #print "ClearStatsu:",tmcdev.check_clear_status()
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             tmcdev.device_write("*IDN?\n")
 *         except:
 */
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L12_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1094
 *         try:
 *             tmcdev.device_write("*IDN?\n")
 *         except:             # <<<<<<<<<<<<<<
 *             tmcdev.abort_bulk_out()
 *             raise
 */
      /*except:*/ {
        __Pyx_AddTraceback("cPyUSBTMC.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1094, __pyx_L9_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);

        /* "cPyUSBTMC.pyx":1095
 *             tmcdev.device_write("*IDN?\n")
 *         except:
 *             tmcdev.abort_bulk_out()             # <<<<<<<<<<<<<<
 *             raise
 *         r=tmcdev.device_read(4096)
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_abort_bulk_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1095, __pyx_L9_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1095, __pyx_L9_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cPyUSBTMC.pyx":1096
 *         except:
 *             tmcdev.abort_bulk_out()
 *             raise             # <<<<<<<<<<<<<<
 *         r=tmcdev.device_read(4096)
 *         #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 */
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
        __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
        __PYX_ERR(0, 1096, __pyx_L9_except_error)
      }
      __pyx_L9_except_error:;

      /* "cPyUSBTMC.pyx":1092
 *     #print "ClearStatsu:",tmcdev.check_clear_status()
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             tmcdev.device_write("*IDN?\n")
 *         except:
 */
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L5_error;
      __pyx_L12_try_end:;
    }

    /* "cPyUSBTMC.pyx":1097
 *             tmcdev.abort_bulk_out()
 *             raise
 *         r=tmcdev.device_read(4096)             # <<<<<<<<<<<<<<
 *         #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *         if (tmcdev.device.idVendor == 1689): #0x0699
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1097, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_int_4096) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_4096);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_r = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cPyUSBTMC.pyx":1099
 *         r=tmcdev.device_read(4096)
 *         #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *         if (tmcdev.device.idVendor == 1689): #0x0699             # <<<<<<<<<<<<<<
 *             tmcdev.device_write(":DATE?\n")
 *             r=tmcdev.device_read(4096)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1099, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_idVendor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1099, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1689, 0x699, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1099, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1099, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":1100
 *         #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *         if (tmcdev.device.idVendor == 1689): #0x0699
 *             tmcdev.device_write(":DATE?\n")             # <<<<<<<<<<<<<<
 *             r=tmcdev.device_read(4096)
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1100, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_DATE) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DATE);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1100, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1101
 *         if (tmcdev.device.idVendor == 1689): #0x0699
 *             tmcdev.device_write(":DATE?\n")
 *             r=tmcdev.device_read(4096)             # <<<<<<<<<<<<<<
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *             #tmcdev.write("DAT:ENC ASCI\n")
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_int_4096) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_4096);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_r, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1104
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *             #tmcdev.write("DAT:ENC ASCI\n")
 *             tmcdev.write("DAT:ENC SRP\n") # 0-255 or 0-16K             # <<<<<<<<<<<<<<
 *             tmcdev.write("DAT:SOU CH1\n")
 *             tmcdev.write("WFMO:BYT_N 1\n")
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_DAT_ENC_SRP) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_ENC_SRP);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1104, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1105
 *             #tmcdev.write("DAT:ENC ASCI\n")
 *             tmcdev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *             tmcdev.write("DAT:SOU CH1\n")             # <<<<<<<<<<<<<<
 *             tmcdev.write("WFMO:BYT_N 1\n")
 *             #tmcdev.write(":CURVE?")
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1105, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_DAT_SOU_CH1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_SOU_CH1);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1105, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1106
 *             tmcdev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *             tmcdev.write("DAT:SOU CH1\n")
 *             tmcdev.write("WFMO:BYT_N 1\n")             # <<<<<<<<<<<<<<
 *             #tmcdev.write(":CURVE?")
 *             #w=tmcdev.read(2000020)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1106, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_WFMO_BYT_N_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WFMO_BYT_N_1);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1106, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1099
 *         r=tmcdev.device_read(4096)
 *         #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *         if (tmcdev.device.idVendor == 1689): #0x0699             # <<<<<<<<<<<<<<
 *             tmcdev.device_write(":DATE?\n")
 *             r=tmcdev.device_read(4096)
 */
      goto __pyx_L15;
    }

    /* "cPyUSBTMC.pyx":1109
 *             #tmcdev.write(":CURVE?")
 *             #w=tmcdev.read(2000020)
 *         elif (tmcdev.device.idVendor == 2391) : #0x0957             # <<<<<<<<<<<<<<
 *             tmcdev.device_write(":WAV:POINTS?\n")
 *             r=tmcdev.device_read(4096)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_idVendor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1109, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2391, 0x957, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1109, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "cPyUSBTMC.pyx":1110
 *             #w=tmcdev.read(2000020)
 *         elif (tmcdev.device.idVendor == 2391) : #0x0957
 *             tmcdev.device_write(":WAV:POINTS?\n")             # <<<<<<<<<<<<<<
 *             r=tmcdev.device_read(4096)
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_WAV_POINTS) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WAV_POINTS);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1111
 *         elif (tmcdev.device.idVendor == 2391) : #0x0957
 *             tmcdev.device_write(":WAV:POINTS?\n")
 *             r=tmcdev.device_read(4096)             # <<<<<<<<<<<<<<
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *     finally:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tmcdev, __pyx_n_s_device_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1111, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_int_4096) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_4096);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1111, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_r, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1109
 *             #tmcdev.write(":CURVE?")
 *             #w=tmcdev.read(2000020)
 *         elif (tmcdev.device.idVendor == 2391) : #0x0957             # <<<<<<<<<<<<<<
 *             tmcdev.device_write(":WAV:POINTS?\n")
 *             r=tmcdev.device_read(4096)
 */
    }
    __pyx_L15:;
  }

  /* "cPyUSBTMC.pyx":1114
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *     finally:
 *         sys.stdout.write("Done")             # <<<<<<<<<<<<<<
 *         return tmcdev
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_s_Done) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_Done);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "cPyUSBTMC.pyx":1115
 *     finally:
 *         sys.stdout.write("Done")
 *         return tmcdev             # <<<<<<<<<<<<<<
 * 
 * def DSO6K_test(dev=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_tmcdev);
      __pyx_r = __pyx_v_tmcdev;
      goto __pyx_L0;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {

        /* "cPyUSBTMC.pyx":1114
 *             #print r.bTag,r.eom,r.msgID,r.TransferSize,r.data.tostring()
 *     finally:
 *         sys.stdout.write("Done")             # <<<<<<<<<<<<<<
 *         return tmcdev
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1114, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1114, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_n_s_Done) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_Done);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cPyUSBTMC.pyx":1115
 *     finally:
 *         sys.stdout.write("Done")
 *         return tmcdev             # <<<<<<<<<<<<<<
 * 
 * def DSO6K_test(dev=None):
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_tmcdev);
        __pyx_r = __pyx_v_tmcdev;
        goto __pyx_L16_return;
      }
      __pyx_L16_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
      __pyx_L17_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L1_error;
    }
  }

  /* "cPyUSBTMC.pyx":1072
 *             self.statusBytes=bytes[1:]
 * #
 * def test():             # <<<<<<<<<<<<<<
 *     #import usb.core, usb.util,usb.backend,usb.backend.libusb1
 *     #dev=usb.core.find(idVendor=0x0957, idProduct=0x0407)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cPyUSBTMC.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_usbdevs);
  __Pyx_XDECREF(__pyx_v_usbdev);
  __Pyx_XDECREF(__pyx_v_tmcdev);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1117
 *         return tmcdev
 * 
 * def DSO6K_test(dev=None):             # <<<<<<<<<<<<<<
 *     import Gnuplot
 *     if not dev:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_17DSO6K_test(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_17DSO6K_test = {"DSO6K_test", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_17DSO6K_test, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_17DSO6K_test(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dev = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DSO6K_test (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dev,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dev);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DSO6K_test") < 0)) __PYX_ERR(0, 1117, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dev = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DSO6K_test", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1117, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.DSO6K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_16DSO6K_test(__pyx_self, __pyx_v_dev);

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

static PyObject *__pyx_pf_9cPyUSBTMC_16DSO6K_test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev) {
  PyObject *__pyx_v_Gnuplot = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_d = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_maker = NULL;
  PyObject *__pyx_v_model = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_sn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_vers = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_wf2 = NULL;
  PyObject *__pyx_v_gp = NULL;
  PyObject *__pyx_v_hl = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DSO6K_test", 0);
  __Pyx_INCREF(__pyx_v_dev);

  /* "cPyUSBTMC.pyx":1118
 * 
 * def DSO6K_test(dev=None):
 *     import Gnuplot             # <<<<<<<<<<<<<<
 *     if not dev:
 *         dev=test()
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_Gnuplot, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Gnuplot = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1119
 * def DSO6K_test(dev=None):
 *     import Gnuplot
 *     if not dev:             # <<<<<<<<<<<<<<
 *         dev=test()
 *     sys.stdout.write("\n")
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dev); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":1120
 *     import Gnuplot
 *     if not dev:
 *         dev=test()             # <<<<<<<<<<<<<<
 *     sys.stdout.write("\n")
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_test); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_dev, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":1119
 * def DSO6K_test(dev=None):
 *     import Gnuplot
 *     if not dev:             # <<<<<<<<<<<<<<
 *         dev=test()
 *     sys.stdout.write("\n")
 */
  }

  /* "cPyUSBTMC.pyx":1121
 *     if not dev:
 *         dev=test()
 *     sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stdout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1122
 *         dev=test()
 *     sys.stdout.write("\n")
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")             # <<<<<<<<<<<<<<
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1123
 *     sys.stdout.write("\n")
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")             # <<<<<<<<<<<<<<
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_IDN_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_IDN_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1123, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1123, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_d = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1124
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1125
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")             # <<<<<<<<<<<<<<
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s__9) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s__9);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1125, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1125, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_9); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1125, __pyx_L1_error)
    __pyx_L7_unpacking_done:;
  }
  __pyx_v_maker = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_model = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_sn = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_vers = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1126
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")             # <<<<<<<<<<<<<<
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_SOURCE_CH1) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_SOURCE_CH1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1127
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")             # <<<<<<<<<<<<<<
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_POINTS_100000) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_POINTS_100000);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1128
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_POINTS) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_POINTS);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1128, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __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_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1128, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_8);
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1129
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())             # <<<<<<<<<<<<<<
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 *     sys.stdout.write("size of waveform %s \n",n)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_stdout); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_WAV_POINT_s, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1130
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)             # <<<<<<<<<<<<<<
 *     sys.stdout.write("size of waveform %s \n",n)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_requestSize, __pyx_int_20000000) < 0) __PYX_ERR(0, 1130, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1130, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_8), 2) < 0) __PYX_ERR(0, 1130, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L11_unpacking_done;
    __pyx_L10_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1130, __pyx_L1_error)
    __pyx_L11_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v_wf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1131
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 *     sys.stdout.write("size of waveform %s \n",n)             # <<<<<<<<<<<<<<
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_stdout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_size_of_waveform_s, __pyx_v_n};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_size_of_waveform_s, __pyx_v_n};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_size_of_waveform_s);
    __Pyx_GIVEREF(__pyx_kp_s_size_of_waveform_s);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_kp_s_size_of_waveform_s);
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_n);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1133
 *     sys.stdout.write("size of waveform %s \n",n)
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")             # <<<<<<<<<<<<<<
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_kp_s_WAV_SOURCE_CH2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_WAV_SOURCE_CH2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1134
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)             # <<<<<<<<<<<<<<
 * 
 *     gp=Gnuplot.Gnuplot()
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_requestSize, __pyx_int_20000000) < 0) __PYX_ERR(0, 1134, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__10, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
    PyObject* sequence = __pyx_t_8;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1134, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1134, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L13_unpacking_done;
    __pyx_L12_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1134, __pyx_L1_error)
    __pyx_L13_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_wf2 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1136
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)
 * 
 *     gp=Gnuplot.Gnuplot()             # <<<<<<<<<<<<<<
 *     gp.title("Python USBTMC module example \\n from %s"%model)
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_Gnuplot, __pyx_n_s_Gnuplot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_gp = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1137
 * 
 *     gp=Gnuplot.Gnuplot()
 *     gp.title("Python USBTMC module example \\n from %s"%model)             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_title); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Python_USBTMC_module_example_n_f, __pyx_v_model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1138
 *     gp=Gnuplot.Gnuplot()
 *     gp.title("Python USBTMC module example \\n from %s"%model)
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])
 *     x0=wf[-1]
 */
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hl = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1139
 *     gp.title("Python USBTMC module example \\n from %s"%model)
 *     hl=int(wf[1:2].tostring())+2
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])             # <<<<<<<<<<<<<<
 *     x0=wf[-1]
 *     return dev
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_plot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, -2L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_slice__12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_wf2, 0, -2L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_slice__12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_6, __pyx_t_4};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_6, __pyx_t_4};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_4);
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1140
 *     hl=int(wf[1:2].tostring())+2
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])
 *     x0=wf[-1]             # <<<<<<<<<<<<<<
 *     return dev
 * 
 */
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_wf, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_x0 = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1141
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])
 *     x0=wf[-1]
 *     return dev             # <<<<<<<<<<<<<<
 * 
 * def DSO6K_test_pylab(dev=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1117
 *         return tmcdev
 * 
 * def DSO6K_test(dev=None):             # <<<<<<<<<<<<<<
 *     import Gnuplot
 *     if not dev:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cPyUSBTMC.DSO6K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Gnuplot);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_maker);
  __Pyx_XDECREF(__pyx_v_model);
  __Pyx_XDECREF(__pyx_v_sn);
  __Pyx_XDECREF(__pyx_v_vers);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_wf2);
  __Pyx_XDECREF(__pyx_v_gp);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1143
 *     return dev
 * 
 * def DSO6K_test_pylab(dev=None):             # <<<<<<<<<<<<<<
 *     import pylab
 *     if not dev:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_19DSO6K_test_pylab(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_19DSO6K_test_pylab = {"DSO6K_test_pylab", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_9cPyUSBTMC_19DSO6K_test_pylab, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_19DSO6K_test_pylab(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dev = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DSO6K_test_pylab (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dev,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dev);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DSO6K_test_pylab") < 0)) __PYX_ERR(0, 1143, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dev = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DSO6K_test_pylab", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1143, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cPyUSBTMC.DSO6K_test_pylab", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cPyUSBTMC_18DSO6K_test_pylab(__pyx_self, __pyx_v_dev);

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

static PyObject *__pyx_pf_9cPyUSBTMC_18DSO6K_test_pylab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev) {
  PyObject *__pyx_v_pylab = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_d = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_maker = NULL;
  PyObject *__pyx_v_model = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_sn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_vers = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_wf2 = NULL;
  PyObject *__pyx_v_hl = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_x0 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DSO6K_test_pylab", 0);
  __Pyx_INCREF(__pyx_v_dev);

  /* "cPyUSBTMC.pyx":1144
 * 
 * def DSO6K_test_pylab(dev=None):
 *     import pylab             # <<<<<<<<<<<<<<
 *     if not dev:
 *         dev=test()
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1145
 * def DSO6K_test_pylab(dev=None):
 *     import pylab
 *     if not dev:             # <<<<<<<<<<<<<<
 *         dev=test()
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dev); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cPyUSBTMC.pyx":1146
 *     import pylab
 *     if not dev:
 *         dev=test()             # <<<<<<<<<<<<<<
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_test); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_dev, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cPyUSBTMC.pyx":1145
 * def DSO6K_test_pylab(dev=None):
 *     import pylab
 *     if not dev:             # <<<<<<<<<<<<<<
 *         dev=test()
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 */
  }

  /* "cPyUSBTMC.pyx":1147
 *     if not dev:
 *         dev=test()
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")             # <<<<<<<<<<<<<<
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1148
 *         dev=test()
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")             # <<<<<<<<<<<<<<
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_IDN_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_IDN_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1148, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1148, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1148, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_d = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1149
 *     dev.write(":STOP;:SINGLE;:WAV:POINTS:MODE MAX;:WAV:POINTS 50000;")
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1150
 *     n,d=dev.ask("*IDN?;")
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")             # <<<<<<<<<<<<<<
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s__9) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s__9);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1150, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_6,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_9); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1150, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1150, __pyx_L1_error)
    __pyx_L7_unpacking_done:;
  }
  __pyx_v_maker = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_model = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_sn = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_vers = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1151
 *     sys.stdout.write(d.tostring());sys.stdout.write("\n")
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")             # <<<<<<<<<<<<<<
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_SOURCE_CH1) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_SOURCE_CH1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1152
 *     maker,model,sn,vers=d.tostring().split(",")
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")             # <<<<<<<<<<<<<<
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_POINTS_100000) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_POINTS_100000);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1153
 *     dev.write(":WAV:SOURCE CH1;\n")
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_kp_s_WAV_POINTS) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_WAV_POINTS);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1153, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1153, __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_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1153, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1153, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_8);
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1154
 *     dev.write(":WAV:POINTS 100000;\n")
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())             # <<<<<<<<<<<<<<
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 *     sys.stdout.write("size of waveform %s \n",n)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_stdout); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_tostring); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_WAV_POINT_s, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1155
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)             # <<<<<<<<<<<<<<
 *     sys.stdout.write("size of waveform %s \n",n)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_requestSize, __pyx_int_20000000) < 0) __PYX_ERR(0, 1155, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1155, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_8), 2) < 0) __PYX_ERR(0, 1155, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L11_unpacking_done;
    __pyx_L10_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1155, __pyx_L1_error)
    __pyx_L11_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v_wf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1156
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)
 *     sys.stdout.write("size of waveform %s \n",n)             # <<<<<<<<<<<<<<
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_stdout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_size_of_waveform_s, __pyx_v_n};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1156, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_size_of_waveform_s, __pyx_v_n};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1156, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_size_of_waveform_s);
    __Pyx_GIVEREF(__pyx_kp_s_size_of_waveform_s);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_kp_s_size_of_waveform_s);
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_n);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1158
 *     sys.stdout.write("size of waveform %s \n",n)
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")             # <<<<<<<<<<<<<<
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_kp_s_WAV_SOURCE_CH2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_WAV_SOURCE_CH2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1159
 * 
 *     dev.write(":WAV:SOURCE CH2;\n")
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)             # <<<<<<<<<<<<<<
 * 
 *     pylab.clf()
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_requestSize, __pyx_int_20000000) < 0) __PYX_ERR(0, 1159, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__10, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
    PyObject* sequence = __pyx_t_8;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1159, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1159, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L13_unpacking_done;
    __pyx_L12_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1159, __pyx_L1_error)
    __pyx_L13_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_wf2 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1161
 *     n,wf2=dev.ask(":WAV:DATA?",requestSize=20000000)
 * 
 *     pylab.clf()             # <<<<<<<<<<<<<<
 *     pylab.title("Python USBTMC module example from %s"%model)
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_clf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1162
 * 
 *     pylab.clf()
 *     pylab.title("Python USBTMC module example from %s"%model)             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_title); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Python_USBTMC_module_example_fro, __pyx_v_model); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1163
 *     pylab.clf()
 *     pylab.title("Python USBTMC module example from %s"%model)
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 */
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hl = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1164
 *     pylab.title("Python USBTMC module example from %s"%model)
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")             # <<<<<<<<<<<<<<
 *     pylab.ylabel("signal")
 *     pylab.plot(range(0,n-hl-2,10),wf[hl:-2][::10], range(0,n-hl-2,10),pylab.array(wf2[hl:-2][::10])-127.)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_xlabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_n_s_points) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_points);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1165
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")             # <<<<<<<<<<<<<<
 *     pylab.plot(range(0,n-hl-2,10),wf[hl:-2][::10], range(0,n-hl-2,10),pylab.array(wf2[hl:-2][::10])-127.)
 *     pylab.show(False)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_ylabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_n_s_signal) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_signal);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1166
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 *     pylab.plot(range(0,n-hl-2,10),wf[hl:-2][::10], range(0,n-hl-2,10),pylab.array(wf2[hl:-2][::10])-127.)             # <<<<<<<<<<<<<<
 *     pylab.show(False)
 *     x0=wf[-1]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_plot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Subtract(__pyx_v_n, __pyx_v_hl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_10);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, -2L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_slice__12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Subtract(__pyx_v_n, __pyx_v_hl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_9);
  __Pyx_INCREF(__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_10);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_wf2, 0, -2L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_12, __pyx_slice__12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13);
  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyFloat_SubtractObjC(__pyx_t_5, __pyx_float_127_, 127., 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_t_4, __pyx_t_9, __pyx_t_11};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1166, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_6, __pyx_t_4, __pyx_t_9, __pyx_t_11};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1166, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_10, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_10, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_10, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_10, __pyx_t_11);
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1167
 *     pylab.ylabel("signal")
 *     pylab.plot(range(0,n-hl-2,10),wf[hl:-2][::10], range(0,n-hl-2,10),pylab.array(wf2[hl:-2][::10])-127.)
 *     pylab.show(False)             # <<<<<<<<<<<<<<
 *     x0=wf[-1]
 *     return dev
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_show); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_8 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_13, Py_False) : __Pyx_PyObject_CallOneArg(__pyx_t_1, Py_False);
  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1168
 *     pylab.plot(range(0,n-hl-2,10),wf[hl:-2][::10], range(0,n-hl-2,10),pylab.array(wf2[hl:-2][::10])-127.)
 *     pylab.show(False)
 *     x0=wf[-1]             # <<<<<<<<<<<<<<
 *     return dev
 * 
 */
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_wf, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_x0 = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cPyUSBTMC.pyx":1169
 *     pylab.show(False)
 *     x0=wf[-1]
 *     return dev             # <<<<<<<<<<<<<<
 * 
 * def DPO4K_test():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1143
 *     return dev
 * 
 * def DSO6K_test_pylab(dev=None):             # <<<<<<<<<<<<<<
 *     import pylab
 *     if not dev:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cPyUSBTMC.DSO6K_test_pylab", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_maker);
  __Pyx_XDECREF(__pyx_v_model);
  __Pyx_XDECREF(__pyx_v_sn);
  __Pyx_XDECREF(__pyx_v_vers);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_wf2);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1171
 *     return dev
 * 
 * def DPO4K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_21DPO4K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_21DPO4K_test = {"DPO4K_test", (PyCFunction)__pyx_pw_9cPyUSBTMC_21DPO4K_test, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_21DPO4K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DPO4K_test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_20DPO4K_test(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_20DPO4K_test(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_pylab = NULL;
  PyObject *__pyx_v_time = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_hl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DPO4K_test", 0);

  /* "cPyUSBTMC.pyx":1172
 * 
 * def DPO4K_test():
 *     import pylab,time             # <<<<<<<<<<<<<<
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_time = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1173
 * def DPO4K_test():
 *     import pylab,time
 *     dev=test()             # <<<<<<<<<<<<<<
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1174
 *     import pylab,time
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")             # <<<<<<<<<<<<<<
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_ENC_ASCI) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_ENC_ASCI);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1174, __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;

  /* "cPyUSBTMC.pyx":1175
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K             # <<<<<<<<<<<<<<
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_ENC_SRP) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_ENC_SRP);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1175, __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;

  /* "cPyUSBTMC.pyx":1176
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")             # <<<<<<<<<<<<<<
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_SOU_CH1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_SOU_CH1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __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;

  /* "cPyUSBTMC.pyx":1177
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")             # <<<<<<<<<<<<<<
 *     s=time.time()
 *     dev.write("CURVE?")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WFMO_BYT_N_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WFMO_BYT_N_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __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;

  /* "cPyUSBTMC.pyx":1178
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()             # <<<<<<<<<<<<<<
 *     dev.write("CURVE?")
 *     n,wf=dev.read(2000020)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_time, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1179
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()
 *     dev.write("CURVE?")             # <<<<<<<<<<<<<<
 *     n,wf=dev.read(2000020)
 *     e=time.time()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_CURVE) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_CURVE);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __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;

  /* "cPyUSBTMC.pyx":1180
 *     s=time.time()
 *     dev.write("CURVE?")
 *     n,wf=dev.read(2000020)             # <<<<<<<<<<<<<<
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_2000020) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_2000020);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1180, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1180, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1180, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_wf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1181
 *     dev.write("CURVE?")
 *     n,wf=dev.read(2000020)
 *     e=time.time()             # <<<<<<<<<<<<<<
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_time, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_e = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1182
 *     n,wf=dev.read(2000020)
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(             # <<<<<<<<<<<<<<
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_stdout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1183
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))             # <<<<<<<<<<<<<<
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_e, __pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Subtract(__pyx_v_e, __pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_n, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_n);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1182
 *     n,wf=dev.read(2000020)
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(             # <<<<<<<<<<<<<<
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 */
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_read_d_bytes_in_f_seconds_f_byte, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __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;

  /* "cPyUSBTMC.pyx":1184
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))
 *     pylab.clf()             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_clf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __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;

  /* "cPyUSBTMC.pyx":1185
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 */
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tostring); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_hl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1186
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")             # <<<<<<<<<<<<<<
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO4034B")
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_xlabel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_n_s_points) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_points);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1187
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")             # <<<<<<<<<<<<<<
 *     pylab.title("Waveform from DPO4034B")
 *     pylab.plot(wf[hl:-1][::100])
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_ylabel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_n_s_signal) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_signal);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1188
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO4034B")             # <<<<<<<<<<<<<<
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_title); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_kp_s_Waveform_from_DPO4034B) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Waveform_from_DPO4034B);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1189
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO4034B")
 *     pylab.plot(wf[hl:-1][::100])             # <<<<<<<<<<<<<<
 *     pylab.show(False)
 *     return dev
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_plot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, -1L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_slice__13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1190
 *     pylab.title("Waveform from DPO4034B")
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)             # <<<<<<<<<<<<<<
 *     return dev
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_show); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, Py_False) : __Pyx_PyObject_CallOneArg(__pyx_t_6, Py_False);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1191
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)
 *     return dev             # <<<<<<<<<<<<<<
 * 
 * def DPO3K_test():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1171
 *     return dev
 * 
 * def DPO4K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */

  /* 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("cPyUSBTMC.DPO4K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1193
 *     return dev
 * 
 * def DPO3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_23DPO3K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_23DPO3K_test = {"DPO3K_test", (PyCFunction)__pyx_pw_9cPyUSBTMC_23DPO3K_test, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_23DPO3K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DPO3K_test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_22DPO3K_test(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_22DPO3K_test(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_pylab = NULL;
  PyObject *__pyx_v_time = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_hl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("DPO3K_test", 0);

  /* "cPyUSBTMC.pyx":1194
 * 
 * def DPO3K_test():
 *     import pylab,time             # <<<<<<<<<<<<<<
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_time = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1195
 * def DPO3K_test():
 *     import pylab,time
 *     dev=test()             # <<<<<<<<<<<<<<
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1196
 *     import pylab,time
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")             # <<<<<<<<<<<<<<
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_ENC_ASCI) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_ENC_ASCI);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __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;

  /* "cPyUSBTMC.pyx":1197
 *     dev=test()
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K             # <<<<<<<<<<<<<<
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_ENC_SRP) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_ENC_SRP);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1197, __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;

  /* "cPyUSBTMC.pyx":1198
 *     dev.write("DAT:ENC ASCI\n")
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")             # <<<<<<<<<<<<<<
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DAT_SOU_CH1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DAT_SOU_CH1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __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;

  /* "cPyUSBTMC.pyx":1199
 *     dev.write("DAT:ENC SRP\n") # 0-255 or 0-16K
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")             # <<<<<<<<<<<<<<
 *     s=time.time()
 *     dev.write("CURVE?")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WFMO_BYT_N_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WFMO_BYT_N_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __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;

  /* "cPyUSBTMC.pyx":1200
 *     dev.write("DAT:SOU CH1\n")
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()             # <<<<<<<<<<<<<<
 *     dev.write("CURVE?")
 *     n,wf=dev.read0(2000020)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_time, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1201
 *     dev.write("WFMO:BYT_N 1\n")
 *     s=time.time()
 *     dev.write("CURVE?")             # <<<<<<<<<<<<<<
 *     n,wf=dev.read0(2000020)
 *     e=time.time()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_CURVE) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_CURVE);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __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;

  /* "cPyUSBTMC.pyx":1202
 *     s=time.time()
 *     dev.write("CURVE?")
 *     n,wf=dev.read0(2000020)             # <<<<<<<<<<<<<<
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_read0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_2000020) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_2000020);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1202, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1202, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1202, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_wf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1203
 *     dev.write("CURVE?")
 *     n,wf=dev.read0(2000020)
 *     e=time.time()             # <<<<<<<<<<<<<<
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_time, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_e = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1204
 *     n,wf=dev.read0(2000020)
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(             # <<<<<<<<<<<<<<
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_stdout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1205
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))             # <<<<<<<<<<<<<<
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_e, __pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Subtract(__pyx_v_e, __pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_n, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_n);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;

  /* "cPyUSBTMC.pyx":1204
 *     n,wf=dev.read0(2000020)
 *     e=time.time()
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(             # <<<<<<<<<<<<<<
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 */
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_read_d_bytes_in_f_seconds_f_byte, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1204, __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;

  /* "cPyUSBTMC.pyx":1206
 *     sys.stdout.write("read %d bytes in %f seconds %f bytes/second"%(
 *             n, e-s,n/(e-s)))
 *     pylab.clf()             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_clf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __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;

  /* "cPyUSBTMC.pyx":1207
 *             n, e-s,n/(e-s)))
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 */
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tostring); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_hl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1208
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")             # <<<<<<<<<<<<<<
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO30xx")
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_xlabel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_n_s_points) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_points);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1209
 *     hl=int(wf[1:2].tostring())+2
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")             # <<<<<<<<<<<<<<
 *     pylab.title("Waveform from DPO30xx")
 *     pylab.plot(wf[hl:-1][::100])
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_ylabel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_n_s_signal) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_signal);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1210
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO30xx")             # <<<<<<<<<<<<<<
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_title); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_kp_s_Waveform_from_DPO30xx) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Waveform_from_DPO30xx);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1211
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO30xx")
 *     pylab.plot(wf[hl:-1][::100])             # <<<<<<<<<<<<<<
 *     pylab.show(False)
 *     return dev
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_plot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, -1L, &__pyx_v_hl, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_slice__13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1212
 *     pylab.title("Waveform from DPO30xx")
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)             # <<<<<<<<<<<<<<
 *     return dev
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_show); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, Py_False) : __Pyx_PyObject_CallOneArg(__pyx_t_6, Py_False);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1213
 *     pylab.plot(wf[hl:-1][::100])
 *     pylab.show(False)
 *     return dev             # <<<<<<<<<<<<<<
 * 
 * def SL1K_test():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1193
 *     return dev
 * 
 * def DPO3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */

  /* 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("cPyUSBTMC.DPO3K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1215
 *     return dev
 * 
 * def SL1K_test():             # <<<<<<<<<<<<<<
 *     import pylab
 *     dev=test()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_25SL1K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_25SL1K_test = {"SL1K_test", (PyCFunction)__pyx_pw_9cPyUSBTMC_25SL1K_test, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_25SL1K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SL1K_test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_24SL1K_test(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_24SL1K_test(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_pylab = NULL;
  PyObject *__pyx_v_dev = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_res = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_hl = NULL;
  PyObject *__pyx_v_nd = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SL1K_test", 0);

  /* "cPyUSBTMC.pyx":1216
 * 
 * def SL1K_test():
 *     import pylab             # <<<<<<<<<<<<<<
 *     dev=test()
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1217
 * def SL1K_test():
 *     import pylab
 *     dev=test()             # <<<<<<<<<<<<<<
 * 
 *     sys.stdout.write(dev.ask(":DATA?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1219
 *     dev=test()
 * 
 *     sys.stdout.write(dev.ask(":DATA?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write(dev.ask(":ACQ?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":WAV?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_DATA) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_DATA);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1219, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1219, __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;

  /* "cPyUSBTMC.pyx":1220
 * 
 *     sys.stdout.write(dev.ask(":DATA?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write(dev.ask(":ACQ?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":WAV?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":TRIG?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_ACQ) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_ACQ);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __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;

  /* "cPyUSBTMC.pyx":1221
 *     sys.stdout.write(dev.ask(":DATA?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write(dev.ask(":ACQ?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":WAV?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":TRIG?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":MEAS?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_WAV) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_WAV);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __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;

  /* "cPyUSBTMC.pyx":1222
 *     sys.stdout.write(dev.ask(":ACQ?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":WAV?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":TRIG?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":MEAS?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":ALARM?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_TRIG) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_TRIG);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __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;

  /* "cPyUSBTMC.pyx":1223
 *     sys.stdout.write( dev.ask(":WAV?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":TRIG?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":MEAS?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":ALARM?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CONTROL?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_MEAS) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_MEAS);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1223, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1223, __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;

  /* "cPyUSBTMC.pyx":1224
 *     sys.stdout.write( dev.ask(":TRIG?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":MEAS?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":ALARM?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":CONTROL?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CHAN1?\n")[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_ALARM) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_ALARM);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __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;

  /* "cPyUSBTMC.pyx":1225
 *     sys.stdout.write( dev.ask(":MEAS?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":ALARM?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CONTROL?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.ask(":CHAN1?\n")[1].tostring());sys.stdout.write("\n")
 *     res=dev.ask(":WAV:LENGTH?")[1].tostring()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_CONTROL) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_CONTROL);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1225, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1225, __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;

  /* "cPyUSBTMC.pyx":1226
 *     sys.stdout.write( dev.ask(":ALARM?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CONTROL?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CHAN1?\n")[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     res=dev.ask(":WAV:LENGTH?")[1].tostring()
 *     dev.write("WAV:FORMAT BYTE\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_CHAN1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_CHAN1);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __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;

  /* "cPyUSBTMC.pyx":1227
 *     sys.stdout.write( dev.ask(":CONTROL?\n")[1].tostring());sys.stdout.write("\n")
 *     sys.stdout.write( dev.ask(":CHAN1?\n")[1].tostring());sys.stdout.write("\n")
 *     res=dev.ask(":WAV:LENGTH?")[1].tostring()             # <<<<<<<<<<<<<<
 *     dev.write("WAV:FORMAT BYTE\n")
 *     dev.write("WAV:TRACE 1\n")
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_WAV_LENGTH) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_WAV_LENGTH);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tostring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1228
 *     sys.stdout.write( dev.ask(":CHAN1?\n")[1].tostring());sys.stdout.write("\n")
 *     res=dev.ask(":WAV:LENGTH?")[1].tostring()
 *     dev.write("WAV:FORMAT BYTE\n")             # <<<<<<<<<<<<<<
 *     dev.write("WAV:TRACE 1\n")
 *     #dev.write(":DATA:FRAW?\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WAV_FORMAT_BYTE) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WAV_FORMAT_BYTE);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1228, __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;

  /* "cPyUSBTMC.pyx":1229
 *     res=dev.ask(":WAV:LENGTH?")[1].tostring()
 *     dev.write("WAV:FORMAT BYTE\n")
 *     dev.write("WAV:TRACE 1\n")             # <<<<<<<<<<<<<<
 *     #dev.write(":DATA:FRAW?\n")
 *     dev.write(":STOP\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WAV_TRACE_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WAV_TRACE_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __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;

  /* "cPyUSBTMC.pyx":1231
 *     dev.write("WAV:TRACE 1\n")
 *     #dev.write(":DATA:FRAW?\n")
 *     dev.write(":STOP\n")             # <<<<<<<<<<<<<<
 *     dev.write(":WAV:SEND?\n")
 *     n,wf=dev.read0(2000020)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_STOP) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_STOP);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1231, __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;

  /* "cPyUSBTMC.pyx":1232
 *     #dev.write(":DATA:FRAW?\n")
 *     dev.write(":STOP\n")
 *     dev.write(":WAV:SEND?\n")             # <<<<<<<<<<<<<<
 *     n,wf=dev.read0(2000020)
 *     pylab.clf()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_WAV_SEND) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_WAV_SEND);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1232, __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;

  /* "cPyUSBTMC.pyx":1233
 *     dev.write(":STOP\n")
 *     dev.write(":WAV:SEND?\n")
 *     n,wf=dev.read0(2000020)             # <<<<<<<<<<<<<<
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_read0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_2000020) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_2000020);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1233, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1233, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1233, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_wf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1234
 *     dev.write(":WAV:SEND?\n")
 *     n,wf=dev.read0(2000020)
 *     pylab.clf()             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_clf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __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;

  /* "cPyUSBTMC.pyx":1235
 *     n,wf=dev.read0(2000020)
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])
 */
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tostring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1236
 *     pylab.clf()
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())             # <<<<<<<<<<<<<<
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 2, 0, NULL, &__pyx_v_hl, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nd = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1237
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])             # <<<<<<<<<<<<<<
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_plot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, 0, &__pyx_v_hl, &__pyx_v_nd, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1238
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")             # <<<<<<<<<<<<<<
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from Yokogawa SL1000")
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_xlabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_s_points) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_points);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1239
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")             # <<<<<<<<<<<<<<
 *     pylab.title("Waveform from Yokogawa SL1000")
 *     return dev
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_ylabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_s_signal) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_signal);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1240
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from Yokogawa SL1000")             # <<<<<<<<<<<<<<
 *     return dev
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_title); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_kp_s_Waveform_from_Yokogawa_SL1000) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Waveform_from_Yokogawa_SL1000);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1241
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from Yokogawa SL1000")
 *     return dev             # <<<<<<<<<<<<<<
 * 
 * def AFG3K_test():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1215
 *     return dev
 * 
 * def SL1K_test():             # <<<<<<<<<<<<<<
 *     import pylab
 *     dev=test()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cPyUSBTMC.SL1K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XDECREF(__pyx_v_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1243
 *     return dev
 * 
 * def AFG3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     devs=find_tmc_devices() #
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_27AFG3K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_27AFG3K_test = {"AFG3K_test", (PyCFunction)__pyx_pw_9cPyUSBTMC_27AFG3K_test, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_27AFG3K_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("AFG3K_test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_26AFG3K_test(__pyx_self);

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

static PyObject *__pyx_pf_9cPyUSBTMC_26AFG3K_test(CYTHON_UNUSED PyObject *__pyx_self) {
  CYTHON_UNUSED PyObject *__pyx_v_pylab = NULL;
  PyObject *__pyx_v_time = NULL;
  PyObject *__pyx_v_devs = NULL;
  PyObject *__pyx_v_dev = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("AFG3K_test", 0);

  /* "cPyUSBTMC.pyx":1244
 * 
 * def AFG3K_test():
 *     import pylab,time             # <<<<<<<<<<<<<<
 *     devs=find_tmc_devices() #
 *     if devs == None:
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_time = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1245
 * def AFG3K_test():
 *     import pylab,time
 *     devs=find_tmc_devices() #             # <<<<<<<<<<<<<<
 *     if devs == None:
 *         return
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_find_tmc_devices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_devs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1246
 *     import pylab,time
 *     devs=find_tmc_devices() #
 *     if devs == None:             # <<<<<<<<<<<<<<
 *         return
 *     dev=USB488_device(devs[0])
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_devs, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cPyUSBTMC.pyx":1247
 *     devs=find_tmc_devices() #
 *     if devs == None:
 *         return             # <<<<<<<<<<<<<<
 *     dev=USB488_device(devs[0])
 *     dev.write("*RST\n");time.sleep(3);
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cPyUSBTMC.pyx":1246
 *     import pylab,time
 *     devs=find_tmc_devices() #
 *     if devs == None:             # <<<<<<<<<<<<<<
 *         return
 *     dev=USB488_device(devs[0])
 */
  }

  /* "cPyUSBTMC.pyx":1248
 *     if devs == None:
 *         return
 *     dev=USB488_device(devs[0])             # <<<<<<<<<<<<<<
 *     dev.write("*RST\n");time.sleep(3);
 *     sys.stdout.write( dev.IDN()[1].tostring());sys.stdout.write("\n")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USB488_device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_devs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dev = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1249
 *         return
 *     dev=USB488_device(devs[0])
 *     dev.write("*RST\n");time.sleep(3);             # <<<<<<<<<<<<<<
 *     sys.stdout.write( dev.IDN()[1].tostring());sys.stdout.write("\n")
 *     AFG3K_setup_test(dev)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_RST_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_RST_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __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;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_time, __pyx_n_s_sleep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_3);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __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;

  /* "cPyUSBTMC.pyx":1250
 *     dev=USB488_device(devs[0])
 *     dev.write("*RST\n");time.sleep(3);
 *     sys.stdout.write( dev.IDN()[1].tostring());sys.stdout.write("\n")             # <<<<<<<<<<<<<<
 *     AFG3K_setup_test(dev)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_IDN_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_tostring); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1250, __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;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1250, __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;

  /* "cPyUSBTMC.pyx":1251
 *     dev.write("*RST\n");time.sleep(3);
 *     sys.stdout.write( dev.IDN()[1].tostring());sys.stdout.write("\n")
 *     AFG3K_setup_test(dev)             # <<<<<<<<<<<<<<
 * 
 * def AFG3K_setup_test(dev):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_AFG3K_setup_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_dev) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dev);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1251, __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;

  /* "cPyUSBTMC.pyx":1243
 *     return dev
 * 
 * def AFG3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     devs=find_tmc_devices() #
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cPyUSBTMC.AFG3K_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XDECREF(__pyx_v_devs);
  __Pyx_XDECREF(__pyx_v_dev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cPyUSBTMC.pyx":1253
 *     AFG3K_setup_test(dev)
 * 
 * def AFG3K_setup_test(dev):             # <<<<<<<<<<<<<<
 *     import pylab
 *     #'Set CH1 output parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cPyUSBTMC_29AFG3K_setup_test(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/
static PyMethodDef __pyx_mdef_9cPyUSBTMC_29AFG3K_setup_test = {"AFG3K_setup_test", (PyCFunction)__pyx_pw_9cPyUSBTMC_29AFG3K_setup_test, METH_O, 0};
static PyObject *__pyx_pw_9cPyUSBTMC_29AFG3K_setup_test(PyObject *__pyx_self, PyObject *__pyx_v_dev) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("AFG3K_setup_test (wrapper)", 0);
  __pyx_r = __pyx_pf_9cPyUSBTMC_28AFG3K_setup_test(__pyx_self, ((PyObject *)__pyx_v_dev));

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

static PyObject *__pyx_pf_9cPyUSBTMC_28AFG3K_setup_test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev) {
  PyObject *__pyx_v_pylab = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_wf = NULL;
  PyObject *__pyx_v_hl = NULL;
  PyObject *__pyx_v_nd = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("AFG3K_setup_test", 0);

  /* "cPyUSBTMC.pyx":1254
 * 
 * def AFG3K_setup_test(dev):
 *     import pylab             # <<<<<<<<<<<<<<
 *     #'Set CH1 output parameters
 *     dev.write ("FUNCTION SIN\n") #Set output waveform SIN
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pylab, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylab = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1256
 *     import pylab
 *     #'Set CH1 output parameters
 *     dev.write ("FUNCTION SIN\n") #Set output waveform SIN             # <<<<<<<<<<<<<<
 *     dev.write ("FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("VOLTAGE:AMPLITUDE 2.00\n") #Set amplitude 2Vpp
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_FUNCTION_SIN) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_FUNCTION_SIN);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1256, __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;

  /* "cPyUSBTMC.pyx":1257
 *     #'Set CH1 output parameters
 *     dev.write ("FUNCTION SIN\n") #Set output waveform SIN
 *     dev.write ("FREQUENCY 10E3\n") #Set frequency 10kHz             # <<<<<<<<<<<<<<
 *     dev.write ("VOLTAGE:AMPLITUDE 2.00\n") #Set amplitude 2Vpp
 *     dev.write ("VOLTAGE:OFFSET 1.00\n") #Set offset 1V
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_FREQUENCY_10E3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_FREQUENCY_10E3);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1257, __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;

  /* "cPyUSBTMC.pyx":1258
 *     dev.write ("FUNCTION SIN\n") #Set output waveform SIN
 *     dev.write ("FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("VOLTAGE:AMPLITUDE 2.00\n") #Set amplitude 2Vpp             # <<<<<<<<<<<<<<
 *     dev.write ("VOLTAGE:OFFSET 1.00\n") #Set offset 1V
 *     dev.write ("PHASE:ADJUST 0DEG\n") #Set phase 0degree
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_VOLTAGE_AMPLITUDE_2_00) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_VOLTAGE_AMPLITUDE_2_00);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1258, __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;

  /* "cPyUSBTMC.pyx":1259
 *     dev.write ("FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("VOLTAGE:AMPLITUDE 2.00\n") #Set amplitude 2Vpp
 *     dev.write ("VOLTAGE:OFFSET 1.00\n") #Set offset 1V             # <<<<<<<<<<<<<<
 *     dev.write ("PHASE:ADJUST 0DEG\n") #Set phase 0degree
 *     #Set CH2 output parameters
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_VOLTAGE_OFFSET_1_00) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_VOLTAGE_OFFSET_1_00);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1259, __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;

  /* "cPyUSBTMC.pyx":1260
 *     dev.write ("VOLTAGE:AMPLITUDE 2.00\n") #Set amplitude 2Vpp
 *     dev.write ("VOLTAGE:OFFSET 1.00\n") #Set offset 1V
 *     dev.write ("PHASE:ADJUST 0DEG\n") #Set phase 0degree             # <<<<<<<<<<<<<<
 *     #Set CH2 output parameters
 *     dev.write ("SOURCE2:FUNCTION SIN\n") #Set output waveform SIN
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_PHASE_ADJUST_0DEG) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_PHASE_ADJUST_0DEG);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1260, __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;

  /* "cPyUSBTMC.pyx":1262
 *     dev.write ("PHASE:ADJUST 0DEG\n") #Set phase 0degree
 *     #Set CH2 output parameters
 *     dev.write ("SOURCE2:FUNCTION SIN\n") #Set output waveform SIN             # <<<<<<<<<<<<<<
 *     dev.write ("SOURCE2:FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("SOURCE2:VOLTAGE:AMPLITUDE 1.00\n") #Set amplitude 1Vpp
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SOURCE2_FUNCTION_SIN) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SOURCE2_FUNCTION_SIN);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __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;

  /* "cPyUSBTMC.pyx":1263
 *     #Set CH2 output parameters
 *     dev.write ("SOURCE2:FUNCTION SIN\n") #Set output waveform SIN
 *     dev.write ("SOURCE2:FREQUENCY 10E3\n") #Set frequency 10kHz             # <<<<<<<<<<<<<<
 *     dev.write ("SOURCE2:VOLTAGE:AMPLITUDE 1.00\n") #Set amplitude 1Vpp
 *     dev.write ("SOURCE2:VOLTAGE:OFFSET 0.00\n") #Set offset 0V
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SOURCE2_FREQUENCY_10E3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SOURCE2_FREQUENCY_10E3);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1263, __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;

  /* "cPyUSBTMC.pyx":1264
 *     dev.write ("SOURCE2:FUNCTION SIN\n") #Set output waveform SIN
 *     dev.write ("SOURCE2:FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("SOURCE2:VOLTAGE:AMPLITUDE 1.00\n") #Set amplitude 1Vpp             # <<<<<<<<<<<<<<
 *     dev.write ("SOURCE2:VOLTAGE:OFFSET 0.00\n") #Set offset 0V
 *     dev.write ("SOURCE2:PHASE:ADJUST 90DEG\n") #Set phase 90degrees
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SOURCE2_VOLTAGE_AMPLITUDE_1_00) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SOURCE2_VOLTAGE_AMPLITUDE_1_00);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1264, __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;

  /* "cPyUSBTMC.pyx":1265
 *     dev.write ("SOURCE2:FREQUENCY 10E3\n") #Set frequency 10kHz
 *     dev.write ("SOURCE2:VOLTAGE:AMPLITUDE 1.00\n") #Set amplitude 1Vpp
 *     dev.write ("SOURCE2:VOLTAGE:OFFSET 0.00\n") #Set offset 0V             # <<<<<<<<<<<<<<
 *     dev.write ("SOURCE2:PHASE:ADJUST 90DEG\n") #Set phase 90degrees
 *     n,wf=dev.ask("DATA:DATA? EMEM\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SOURCE2_VOLTAGE_OFFSET_0_00) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SOURCE2_VOLTAGE_OFFSET_0_00);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1265, __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;

  /* "cPyUSBTMC.pyx":1266
 *     dev.write ("SOURCE2:VOLTAGE:AMPLITUDE 1.00\n") #Set amplitude 1Vpp
 *     dev.write ("SOURCE2:VOLTAGE:OFFSET 0.00\n") #Set offset 0V
 *     dev.write ("SOURCE2:PHASE:ADJUST 90DEG\n") #Set phase 90degrees             # <<<<<<<<<<<<<<
 *     n,wf=dev.ask("DATA:DATA? EMEM\n")
 *     hl=int(wf[1:2].tostring())+2
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_SOURCE2_PHASE_ADJUST_90DEG) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_SOURCE2_PHASE_ADJUST_90DEG);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1266, __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;

  /* "cPyUSBTMC.pyx":1267
 *     dev.write ("SOURCE2:VOLTAGE:OFFSET 0.00\n") #Set offset 0V
 *     dev.write ("SOURCE2:PHASE:ADJUST 90DEG\n") #Set phase 90degrees
 *     n,wf=dev.ask("DATA:DATA? EMEM\n")             # <<<<<<<<<<<<<<
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dev, __pyx_n_s_ask); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_DATA_DATA_EMEM) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_DATA_DATA_EMEM);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1267, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1267, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1267, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_n = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_wf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1268
 *     dev.write ("SOURCE2:PHASE:ADJUST 90DEG\n") #Set phase 90degrees
 *     n,wf=dev.ask("DATA:DATA? EMEM\n")
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])
 */
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 1, 2, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tostring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1269
 *     n,wf=dev.ask("DATA:DATA? EMEM\n")
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())             # <<<<<<<<<<<<<<
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 2, 0, NULL, &__pyx_v_hl, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nd = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1270
 *     hl=int(wf[1:2].tostring())+2
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])             # <<<<<<<<<<<<<<
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_plot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_wf, 0, 0, &__pyx_v_hl, &__pyx_v_nd, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && 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);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1271
 *     nd=int(wf[2:hl].tostring())
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")             # <<<<<<<<<<<<<<
 *     pylab.ylabel("signal")
 *     pylab.title("EMEM data from Tektronix AFG3000 series")
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_xlabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_s_points) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_points);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1272
 *     pylab.plot(wf[hl:nd])
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")             # <<<<<<<<<<<<<<
 *     pylab.title("EMEM data from Tektronix AFG3000 series")
 *     #Save settings and output on
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_ylabel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_s_signal) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_signal);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1273
 *     pylab.xlabel("points")
 *     pylab.ylabel("signal")
 *     pylab.title("EMEM data from Tektronix AFG3000 series")             # <<<<<<<<<<<<<<
 *     #Save settings and output on
 *     #dev.write ("*SAV 1\n") #Save settings to Setup1
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pylab, __pyx_n_s_title); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_kp_s_EMEM_data_from_Tektronix_AFG3000) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_EMEM_data_from_Tektronix_AFG3000);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":1277
 *     #dev.write ("*SAV 1\n") #Save settings to Setup1
 *     #dev.write ("*RCL 1\n") #Recall settings from Setup1
 *     return dev             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dev);
  __pyx_r = __pyx_v_dev;
  goto __pyx_L0;

  /* "cPyUSBTMC.pyx":1253
 *     AFG3K_setup_test(dev)
 * 
 * def AFG3K_setup_test(dev):             # <<<<<<<<<<<<<<
 *     import pylab
 *     #'Set CH1 output parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cPyUSBTMC.AFG3K_setup_test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylab);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_wf);
  __Pyx_XDECREF(__pyx_v_hl);
  __Pyx_XDECREF(__pyx_v_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_cPyUSBTMC(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_cPyUSBTMC},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "cPyUSBTMC",
    __pyx_k_PyUSBTMC_python_module_to_handl, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_0x_2x_2x, __pyx_k_0x_2x_2x, sizeof(__pyx_k_0x_2x_2x), 0, 0, 1, 0},
  {&__pyx_kp_s_1c_1c_1c, __pyx_k_1c_1c_1c, sizeof(__pyx_k_1c_1c_1c), 0, 0, 1, 0},
  {&__pyx_kp_s_ACQ, __pyx_k_ACQ, sizeof(__pyx_k_ACQ), 0, 0, 1, 0},
  {&__pyx_n_s_AFG3K_setup_test, __pyx_k_AFG3K_setup_test, sizeof(__pyx_k_AFG3K_setup_test), 0, 0, 1, 1},
  {&__pyx_n_s_AFG3K_test, __pyx_k_AFG3K_test, sizeof(__pyx_k_AFG3K_test), 0, 0, 1, 1},
  {&__pyx_kp_s_ALARM, __pyx_k_ALARM, sizeof(__pyx_k_ALARM), 0, 0, 1, 0},
  {&__pyx_kp_s_Abort_bulk_out_Error, __pyx_k_Abort_bulk_out_Error, sizeof(__pyx_k_Abort_bulk_out_Error), 0, 0, 1, 0},
  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
  {&__pyx_n_s_BulkIn_Header, __pyx_k_BulkIn_Header, sizeof(__pyx_k_BulkIn_Header), 0, 0, 1, 1},
  {&__pyx_n_s_BulkIn_Header___init, __pyx_k_BulkIn_Header___init, sizeof(__pyx_k_BulkIn_Header___init), 0, 0, 1, 1},
  {&__pyx_kp_s_CAL, __pyx_k_CAL, sizeof(__pyx_k_CAL), 0, 0, 1, 0},
  {&__pyx_n_s_CAL_2, __pyx_k_CAL_2, sizeof(__pyx_k_CAL_2), 0, 0, 1, 1},
  {&__pyx_kp_s_CHAN1, __pyx_k_CHAN1, sizeof(__pyx_k_CHAN1), 0, 0, 1, 0},
  {&__pyx_n_s_CHECK_ABORT_BULK_IN_STATUS, __pyx_k_CHECK_ABORT_BULK_IN_STATUS, sizeof(__pyx_k_CHECK_ABORT_BULK_IN_STATUS), 0, 0, 1, 1},
  {&__pyx_n_s_CHECK_ABORT_BULK_OUT_STATUS, __pyx_k_CHECK_ABORT_BULK_OUT_STATUS, sizeof(__pyx_k_CHECK_ABORT_BULK_OUT_STATUS), 0, 0, 1, 1},
  {&__pyx_n_s_CHECK_CLEAR_STATUS, __pyx_k_CHECK_CLEAR_STATUS, sizeof(__pyx_k_CHECK_CLEAR_STATUS), 0, 0, 1, 1},
  {&__pyx_kp_s_CLS, __pyx_k_CLS, sizeof(__pyx_k_CLS), 0, 0, 1, 0},
  {&__pyx_n_s_CLS_2, __pyx_k_CLS_2, sizeof(__pyx_k_CLS_2), 0, 0, 1, 1},
  {&__pyx_kp_s_CONTROL, __pyx_k_CONTROL, sizeof(__pyx_k_CONTROL), 0, 0, 1, 0},
  {&__pyx_n_s_CTRL_IN, __pyx_k_CTRL_IN, sizeof(__pyx_k_CTRL_IN), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_OUT, __pyx_k_CTRL_OUT, sizeof(__pyx_k_CTRL_OUT), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_RECIPIENT_DEVICE, __pyx_k_CTRL_RECIPIENT_DEVICE, sizeof(__pyx_k_CTRL_RECIPIENT_DEVICE), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_RECIPIENT_ENDPOINT, __pyx_k_CTRL_RECIPIENT_ENDPOINT, sizeof(__pyx_k_CTRL_RECIPIENT_ENDPOINT), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_RECIPIENT_INTERFACE, __pyx_k_CTRL_RECIPIENT_INTERFACE, sizeof(__pyx_k_CTRL_RECIPIENT_INTERFACE), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_RECIPIENT_OTHER, __pyx_k_CTRL_RECIPIENT_OTHER, sizeof(__pyx_k_CTRL_RECIPIENT_OTHER), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_TYPE_CLASS, __pyx_k_CTRL_TYPE_CLASS, sizeof(__pyx_k_CTRL_TYPE_CLASS), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_TYPE_RESERVED, __pyx_k_CTRL_TYPE_RESERVED, sizeof(__pyx_k_CTRL_TYPE_RESERVED), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_TYPE_STANDARD, __pyx_k_CTRL_TYPE_STANDARD, sizeof(__pyx_k_CTRL_TYPE_STANDARD), 0, 0, 1, 1},
  {&__pyx_n_s_CTRL_TYPE_VENDOR, __pyx_k_CTRL_TYPE_VENDOR, sizeof(__pyx_k_CTRL_TYPE_VENDOR), 0, 0, 1, 1},
  {&__pyx_kp_s_CURVE, __pyx_k_CURVE, sizeof(__pyx_k_CURVE), 0, 0, 1, 0},
  {&__pyx_kp_s_Couldn_t_clear_device_buffer_wit, __pyx_k_Couldn_t_clear_device_buffer_wit, sizeof(__pyx_k_Couldn_t_clear_device_buffer_wit), 0, 0, 1, 0},
  {&__pyx_kp_s_DATA, __pyx_k_DATA, sizeof(__pyx_k_DATA), 0, 0, 1, 0},
  {&__pyx_kp_s_DATA_DATA_EMEM, __pyx_k_DATA_DATA_EMEM, sizeof(__pyx_k_DATA_DATA_EMEM), 0, 0, 1, 0},
  {&__pyx_kp_s_DATE, __pyx_k_DATE, sizeof(__pyx_k_DATE), 0, 0, 1, 0},
  {&__pyx_kp_s_DAT_ENC_ASCI, __pyx_k_DAT_ENC_ASCI, sizeof(__pyx_k_DAT_ENC_ASCI), 0, 0, 1, 0},
  {&__pyx_kp_s_DAT_ENC_SRP, __pyx_k_DAT_ENC_SRP, sizeof(__pyx_k_DAT_ENC_SRP), 0, 0, 1, 0},
  {&__pyx_kp_s_DAT_SOU_CH1, __pyx_k_DAT_SOU_CH1, sizeof(__pyx_k_DAT_SOU_CH1), 0, 0, 1, 0},
  {&__pyx_kp_s_DCL, __pyx_k_DCL, sizeof(__pyx_k_DCL), 0, 0, 1, 0},
  {&__pyx_n_s_DCL_2, __pyx_k_DCL_2, sizeof(__pyx_k_DCL_2), 0, 0, 1, 1},
  {&__pyx_kp_s_DDT, __pyx_k_DDT, sizeof(__pyx_k_DDT), 0, 0, 1, 0},
  {&__pyx_kp_s_DDT_2, __pyx_k_DDT_2, sizeof(__pyx_k_DDT_2), 0, 0, 1, 0},
  {&__pyx_n_s_DDT_3, __pyx_k_DDT_3, sizeof(__pyx_k_DDT_3), 0, 0, 1, 1},
  {&__pyx_n_s_DESC_TYPE_CONFIG, __pyx_k_DESC_TYPE_CONFIG, sizeof(__pyx_k_DESC_TYPE_CONFIG), 0, 0, 1, 1},
  {&__pyx_n_s_DESC_TYPE_DEVICE, __pyx_k_DESC_TYPE_DEVICE, sizeof(__pyx_k_DESC_TYPE_DEVICE), 0, 0, 1, 1},
  {&__pyx_n_s_DESC_TYPE_ENDPOINT, __pyx_k_DESC_TYPE_ENDPOINT, sizeof(__pyx_k_DESC_TYPE_ENDPOINT), 0, 0, 1, 1},
  {&__pyx_n_s_DESC_TYPE_INTERFACE, __pyx_k_DESC_TYPE_INTERFACE, sizeof(__pyx_k_DESC_TYPE_INTERFACE), 0, 0, 1, 1},
  {&__pyx_n_s_DESC_TYPE_STRING, __pyx_k_DESC_TYPE_STRING, sizeof(__pyx_k_DESC_TYPE_STRING), 0, 0, 1, 1},
  {&__pyx_n_s_DEVICE_REMOTE_WAKEUP, __pyx_k_DEVICE_REMOTE_WAKEUP, sizeof(__pyx_k_DEVICE_REMOTE_WAKEUP), 0, 0, 1, 1},
  {&__pyx_n_s_DEV_DEP_MSG_IN, __pyx_k_DEV_DEP_MSG_IN, sizeof(__pyx_k_DEV_DEP_MSG_IN), 0, 0, 1, 1},
  {&__pyx_n_s_DEV_DEP_MSG_OUT, __pyx_k_DEV_DEP_MSG_OUT, sizeof(__pyx_k_DEV_DEP_MSG_OUT), 0, 0, 1, 1},
  {&__pyx_kp_s_DMC, __pyx_k_DMC, sizeof(__pyx_k_DMC), 0, 0, 1, 0},
  {&__pyx_n_s_DMC_2, __pyx_k_DMC_2, sizeof(__pyx_k_DMC_2), 0, 0, 1, 1},
  {&__pyx_n_s_DPO3K_test, __pyx_k_DPO3K_test, sizeof(__pyx_k_DPO3K_test), 0, 0, 1, 1},
  {&__pyx_n_s_DPO4K_test, __pyx_k_DPO4K_test, sizeof(__pyx_k_DPO4K_test), 0, 0, 1, 1},
  {&__pyx_n_s_DSO6K_test, __pyx_k_DSO6K_test, sizeof(__pyx_k_DSO6K_test), 0, 0, 1, 1},
  {&__pyx_n_s_DSO6K_test_pylab, __pyx_k_DSO6K_test_pylab, sizeof(__pyx_k_DSO6K_test_pylab), 0, 0, 1, 1},
  {&__pyx_n_s_DT1, __pyx_k_DT1, sizeof(__pyx_k_DT1), 0, 0, 1, 1},
  {&__pyx_n_s_DevDep_Responce, __pyx_k_DevDep_Responce, sizeof(__pyx_k_DevDep_Responce), 0, 0, 1, 1},
  {&__pyx_n_s_DevDep_Responce___init, __pyx_k_DevDep_Responce___init, sizeof(__pyx_k_DevDep_Responce___init), 0, 0, 1, 1},
  {&__pyx_n_s_Device, __pyx_k_Device, sizeof(__pyx_k_Device), 0, 0, 1, 1},
  {&__pyx_n_s_Done, __pyx_k_Done, sizeof(__pyx_k_Done), 0, 0, 1, 1},
  {&__pyx_kp_s_EMC, __pyx_k_EMC, sizeof(__pyx_k_EMC), 0, 0, 1, 0},
  {&__pyx_kp_s_EMC_2, __pyx_k_EMC_2, sizeof(__pyx_k_EMC_2), 0, 0, 1, 0},
  {&__pyx_n_s_EMC_3, __pyx_k_EMC_3, sizeof(__pyx_k_EMC_3), 0, 0, 1, 1},
  {&__pyx_kp_s_EMEM_data_from_Tektronix_AFG3000, __pyx_k_EMEM_data_from_Tektronix_AFG3000, sizeof(__pyx_k_EMEM_data_from_Tektronix_AFG3000), 0, 0, 1, 0},
  {&__pyx_n_s_ENDPOINT_DIR_MASK, __pyx_k_ENDPOINT_DIR_MASK, sizeof(__pyx_k_ENDPOINT_DIR_MASK), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_HALT, __pyx_k_ENDPOINT_HALT, sizeof(__pyx_k_ENDPOINT_HALT), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_IN, __pyx_k_ENDPOINT_IN, sizeof(__pyx_k_ENDPOINT_IN), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_OUT, __pyx_k_ENDPOINT_OUT, sizeof(__pyx_k_ENDPOINT_OUT), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_BULK, __pyx_k_ENDPOINT_TYPE_BULK, sizeof(__pyx_k_ENDPOINT_TYPE_BULK), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_CTRL, __pyx_k_ENDPOINT_TYPE_CTRL, sizeof(__pyx_k_ENDPOINT_TYPE_CTRL), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_INTERRUPT, __pyx_k_ENDPOINT_TYPE_INTERRUPT, sizeof(__pyx_k_ENDPOINT_TYPE_INTERRUPT), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_INTR, __pyx_k_ENDPOINT_TYPE_INTR, sizeof(__pyx_k_ENDPOINT_TYPE_INTR), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_ISO, __pyx_k_ENDPOINT_TYPE_ISO, sizeof(__pyx_k_ENDPOINT_TYPE_ISO), 0, 0, 1, 1},
  {&__pyx_n_s_ENDPOINT_TYPE_MASK, __pyx_k_ENDPOINT_TYPE_MASK, sizeof(__pyx_k_ENDPOINT_TYPE_MASK), 0, 0, 1, 1},
  {&__pyx_n_s_ESB, __pyx_k_ESB, sizeof(__pyx_k_ESB), 0, 0, 1, 1},
  {&__pyx_kp_s_ESE, __pyx_k_ESE, sizeof(__pyx_k_ESE), 0, 0, 1, 0},
  {&__pyx_kp_s_ESE_2, __pyx_k_ESE_2, sizeof(__pyx_k_ESE_2), 0, 0, 1, 0},
  {&__pyx_n_s_ESE_3, __pyx_k_ESE_3, sizeof(__pyx_k_ESE_3), 0, 0, 1, 1},
  {&__pyx_kp_s_ESQ, __pyx_k_ESQ, sizeof(__pyx_k_ESQ), 0, 0, 1, 0},
  {&__pyx_n_s_ESR, __pyx_k_ESR, sizeof(__pyx_k_ESR), 0, 0, 1, 1},
  {&__pyx_n_s_FAILED, __pyx_k_FAILED, sizeof(__pyx_k_FAILED), 0, 0, 1, 1},
  {&__pyx_kp_s_FREQUENCY_10E3, __pyx_k_FREQUENCY_10E3, sizeof(__pyx_k_FREQUENCY_10E3), 0, 0, 1, 0},
  {&__pyx_kp_s_FUNCTION_SIN, __pyx_k_FUNCTION_SIN, sizeof(__pyx_k_FUNCTION_SIN), 0, 0, 1, 0},
  {&__pyx_n_s_Failed, __pyx_k_Failed, sizeof(__pyx_k_Failed), 0, 0, 1, 1},
  {&__pyx_n_s_GET_CAPABILITIES, __pyx_k_GET_CAPABILITIES, sizeof(__pyx_k_GET_CAPABILITIES), 0, 0, 1, 1},
  {&__pyx_kp_s_GMC, __pyx_k_GMC, sizeof(__pyx_k_GMC), 0, 0, 1, 0},
  {&__pyx_n_s_GMC_2, __pyx_k_GMC_2, sizeof(__pyx_k_GMC_2), 0, 0, 1, 1},
  {&__pyx_n_s_GOTO_LOCAL, __pyx_k_GOTO_LOCAL, sizeof(__pyx_k_GOTO_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_GetExecuteTrigger, __pyx_k_GetExecuteTrigger, sizeof(__pyx_k_GetExecuteTrigger), 0, 0, 1, 1},
  {&__pyx_n_s_Gnuplot, __pyx_k_Gnuplot, sizeof(__pyx_k_Gnuplot), 0, 0, 1, 1},
  {&__pyx_n_s_GoToLocal, __pyx_k_GoToLocal, sizeof(__pyx_k_GoToLocal), 0, 0, 1, 1},
  {&__pyx_kp_s_IDN, __pyx_k_IDN, sizeof(__pyx_k_IDN), 0, 0, 1, 0},
  {&__pyx_kp_s_IDN_2, __pyx_k_IDN_2, sizeof(__pyx_k_IDN_2), 0, 0, 1, 0},
  {&__pyx_kp_s_IDN_3, __pyx_k_IDN_3, sizeof(__pyx_k_IDN_3), 0, 0, 1, 0},
  {&__pyx_n_s_IDN_4, __pyx_k_IDN_4, sizeof(__pyx_k_IDN_4), 0, 0, 1, 1},
  {&__pyx_n_s_IEEE488_Status_Byte_Reg, __pyx_k_IEEE488_Status_Byte_Reg, sizeof(__pyx_k_IEEE488_Status_Byte_Reg), 0, 0, 1, 1},
  {&__pyx_n_s_IEEE488_Status_Byte_Reg___init, __pyx_k_IEEE488_Status_Byte_Reg___init, sizeof(__pyx_k_IEEE488_Status_Byte_Reg___init), 0, 0, 1, 1},
  {&__pyx_n_s_INDICATOR_PULSE, __pyx_k_INDICATOR_PULSE, sizeof(__pyx_k_INDICATOR_PULSE), 0, 0, 1, 1},
  {&__pyx_kp_s_INDICATOR_PULSE_is_not_supported, __pyx_k_INDICATOR_PULSE_is_not_supported, sizeof(__pyx_k_INDICATOR_PULSE_is_not_supported), 0, 0, 1, 0},
  {&__pyx_n_s_INITIATE_ABORT_BULK_IN, __pyx_k_INITIATE_ABORT_BULK_IN, sizeof(__pyx_k_INITIATE_ABORT_BULK_IN), 0, 0, 1, 1},
  {&__pyx_n_s_INITIATE_ABORT_BULK_OUT, __pyx_k_INITIATE_ABORT_BULK_OUT, sizeof(__pyx_k_INITIATE_ABORT_BULK_OUT), 0, 0, 1, 1},
  {&__pyx_n_s_INITIATE_CLEAR, __pyx_k_INITIATE_CLEAR, sizeof(__pyx_k_INITIATE_CLEAR), 0, 0, 1, 1},
  {&__pyx_n_s_INTERRUPT_IN_BUSY, __pyx_k_INTERRUPT_IN_BUSY, sizeof(__pyx_k_INTERRUPT_IN_BUSY), 0, 0, 1, 1},
  {&__pyx_kp_s_Initiate_abort_bulk_in_failed_d, __pyx_k_Initiate_abort_bulk_in_failed_d, sizeof(__pyx_k_Initiate_abort_bulk_in_failed_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Initiate_abort_bulk_out_failed, __pyx_k_Initiate_abort_bulk_out_failed, sizeof(__pyx_k_Initiate_abort_bulk_out_failed), 0, 0, 1, 0},
  {&__pyx_n_s_Interrupt_IN_Data, __pyx_k_Interrupt_IN_Data, sizeof(__pyx_k_Interrupt_IN_Data), 0, 0, 1, 1},
  {&__pyx_n_s_Interrupt_IN_Data___init, __pyx_k_Interrupt_IN_Data___init, sizeof(__pyx_k_Interrupt_IN_Data___init), 0, 0, 1, 1},
  {&__pyx_kp_s_Interrupt_in_busy, __pyx_k_Interrupt_in_busy, sizeof(__pyx_k_Interrupt_in_busy), 0, 0, 1, 0},
  {&__pyx_kp_s_LMC, __pyx_k_LMC, sizeof(__pyx_k_LMC), 0, 0, 1, 0},
  {&__pyx_n_s_LMC_2, __pyx_k_LMC_2, sizeof(__pyx_k_LMC_2), 0, 0, 1, 1},
  {&__pyx_n_s_LOCAL_LOCKOUT, __pyx_k_LOCAL_LOCKOUT, sizeof(__pyx_k_LOCAL_LOCKOUT), 0, 0, 1, 1},
  {&__pyx_kp_s_LRN, __pyx_k_LRN, sizeof(__pyx_k_LRN), 0, 0, 1, 0},
  {&__pyx_n_s_LRN_2, __pyx_k_LRN_2, sizeof(__pyx_k_LRN_2), 0, 0, 1, 1},
  {&__pyx_n_s_LocalLockOut, __pyx_k_LocalLockOut, sizeof(__pyx_k_LocalLockOut), 0, 0, 1, 1},
  {&__pyx_n_s_MAV, __pyx_k_MAV, sizeof(__pyx_k_MAV), 0, 0, 1, 1},
  {&__pyx_kp_s_MEAS, __pyx_k_MEAS, sizeof(__pyx_k_MEAS), 0, 0, 1, 0},
  {&__pyx_n_s_MSG, __pyx_k_MSG, sizeof(__pyx_k_MSG), 0, 0, 1, 1},
  {&__pyx_n_s_Mandatory_LANGID, __pyx_k_Mandatory_LANGID, sizeof(__pyx_k_Mandatory_LANGID), 0, 0, 1, 1},
  {&__pyx_kp_s_Not_Implemented, __pyx_k_Not_Implemented, sizeof(__pyx_k_Not_Implemented), 0, 0, 1, 0},
  {&__pyx_kp_s_OPC, __pyx_k_OPC, sizeof(__pyx_k_OPC), 0, 0, 1, 0},
  {&__pyx_kp_s_OPC_2, __pyx_k_OPC_2, sizeof(__pyx_k_OPC_2), 0, 0, 1, 0},
  {&__pyx_n_s_OPC_3, __pyx_k_OPC_3, sizeof(__pyx_k_OPC_3), 0, 0, 1, 1},
  {&__pyx_n_s_OPER, __pyx_k_OPER, sizeof(__pyx_k_OPER), 0, 0, 1, 1},
  {&__pyx_kp_s_OPT, __pyx_k_OPT, sizeof(__pyx_k_OPT), 0, 0, 1, 0},
  {&__pyx_n_s_OPT_2, __pyx_k_OPT_2, sizeof(__pyx_k_OPT_2), 0, 0, 1, 1},
  {&__pyx_n_s_PENDING, __pyx_k_PENDING, sizeof(__pyx_k_PENDING), 0, 0, 1, 1},
  {&__pyx_kp_s_PHASE_ADJUST_0DEG, __pyx_k_PHASE_ADJUST_0DEG, sizeof(__pyx_k_PHASE_ADJUST_0DEG), 0, 0, 1, 0},
  {&__pyx_kp_s_PSC, __pyx_k_PSC, sizeof(__pyx_k_PSC), 0, 0, 1, 0},
  {&__pyx_kp_s_PSC_2, __pyx_k_PSC_2, sizeof(__pyx_k_PSC_2), 0, 0, 1, 0},
  {&__pyx_n_s_PSC_3, __pyx_k_PSC_3, sizeof(__pyx_k_PSC_3), 0, 0, 1, 1},
  {&__pyx_kp_s_PUD, __pyx_k_PUD, sizeof(__pyx_k_PUD), 0, 0, 1, 0},
  {&__pyx_n_s_PUD_2, __pyx_k_PUD_2, sizeof(__pyx_k_PUD_2), 0, 0, 1, 1},
  {&__pyx_n_s_Pending, __pyx_k_Pending, sizeof(__pyx_k_Pending), 0, 0, 1, 1},
  {&__pyx_kp_s_Python_USBTMC_module_example_fro, __pyx_k_Python_USBTMC_module_example_fro, sizeof(__pyx_k_Python_USBTMC_module_example_fro), 0, 0, 1, 0},
  {&__pyx_kp_s_Python_USBTMC_module_example_n_f, __pyx_k_Python_USBTMC_module_example_n_f, sizeof(__pyx_k_Python_USBTMC_module_example_n_f), 0, 0, 1, 0},
  {&__pyx_kp_s_RCL, __pyx_k_RCL, sizeof(__pyx_k_RCL), 0, 0, 1, 0},
  {&__pyx_n_s_RCL_2, __pyx_k_RCL_2, sizeof(__pyx_k_RCL_2), 0, 0, 1, 1},
  {&__pyx_kp_s_RDT, __pyx_k_RDT, sizeof(__pyx_k_RDT), 0, 0, 1, 0},
  {&__pyx_kp_s_RDT_2, __pyx_k_RDT_2, sizeof(__pyx_k_RDT_2), 0, 0, 1, 0},
  {&__pyx_n_s_RDT_3, __pyx_k_RDT_3, sizeof(__pyx_k_RDT_3), 0, 0, 1, 1},
  {&__pyx_n_s_READ_STATUS_BYTE, __pyx_k_READ_STATUS_BYTE, sizeof(__pyx_k_READ_STATUS_BYTE), 0, 0, 1, 1},
  {&__pyx_n_s_REN_CONTROL, __pyx_k_REN_CONTROL, sizeof(__pyx_k_REN_CONTROL), 0, 0, 1, 1},
  {&__pyx_n_s_REQUEST_DEV_DEP_MSG_IN, __pyx_k_REQUEST_DEV_DEP_MSG_IN, sizeof(__pyx_k_REQUEST_DEV_DEP_MSG_IN), 0, 0, 1, 1},
  {&__pyx_n_s_REQUEST_VENDOR_SPECIFIC_IN, __pyx_k_REQUEST_VENDOR_SPECIFIC_IN, sizeof(__pyx_k_REQUEST_VENDOR_SPECIFIC_IN), 0, 0, 1, 1},
  {&__pyx_n_s_REQ_CLEAR_FEATURE, __pyx_k_REQ_CLEAR_FEATURE, sizeof(__pyx_k_REQ_CLEAR_FEATURE), 0, 0, 1, 1},
  {&__pyx_n_s_RL1, __pyx_k_RL1, sizeof(__pyx_k_RL1), 0, 0, 1, 1},
  {&__pyx_kp_s_RMC, __pyx_k_RMC, sizeof(__pyx_k_RMC), 0, 0, 1, 0},
  {&__pyx_n_s_RMC_2, __pyx_k_RMC_2, sizeof(__pyx_k_RMC_2), 0, 0, 1, 1},
  {&__pyx_n_s_RQS_MSS, __pyx_k_RQS_MSS, sizeof(__pyx_k_RQS_MSS), 0, 0, 1, 1},
  {&__pyx_kp_s_RST, __pyx_k_RST, sizeof(__pyx_k_RST), 0, 0, 1, 0},
  {&__pyx_kp_s_RST_2, __pyx_k_RST_2, sizeof(__pyx_k_RST_2), 0, 0, 1, 0},
  {&__pyx_n_s_RST_3, __pyx_k_RST_3, sizeof(__pyx_k_RST_3), 0, 0, 1, 1},
  {&__pyx_n_s_Read_Status_Byte, __pyx_k_Read_Status_Byte, sizeof(__pyx_k_Read_Status_Byte), 0, 0, 1, 1},
  {&__pyx_n_s_RemoteEnable, __pyx_k_RemoteEnable, sizeof(__pyx_k_RemoteEnable), 0, 0, 1, 1},
  {&__pyx_n_s_Reserved, __pyx_k_Reserved, sizeof(__pyx_k_Reserved), 0, 0, 1, 1},
  {&__pyx_n_s_SAD, __pyx_k_SAD, sizeof(__pyx_k_SAD), 0, 0, 1, 1},
  {&__pyx_kp_s_SAV, __pyx_k_SAV, sizeof(__pyx_k_SAV), 0, 0, 1, 0},
  {&__pyx_n_s_SAV_2, __pyx_k_SAV_2, sizeof(__pyx_k_SAV_2), 0, 0, 1, 1},
  {&__pyx_n_s_SBR, __pyx_k_SBR, sizeof(__pyx_k_SBR), 0, 0, 1, 1},
  {&__pyx_n_s_SCPI, __pyx_k_SCPI, sizeof(__pyx_k_SCPI), 0, 0, 1, 1},
  {&__pyx_kp_s_SDS, __pyx_k_SDS, sizeof(__pyx_k_SDS), 0, 0, 1, 0},
  {&__pyx_n_s_SDS_2, __pyx_k_SDS_2, sizeof(__pyx_k_SDS_2), 0, 0, 1, 1},
  {&__pyx_n_s_SL1K_test, __pyx_k_SL1K_test, sizeof(__pyx_k_SL1K_test), 0, 0, 1, 1},
  {&__pyx_kp_s_SOURCE2_FREQUENCY_10E3, __pyx_k_SOURCE2_FREQUENCY_10E3, sizeof(__pyx_k_SOURCE2_FREQUENCY_10E3), 0, 0, 1, 0},
  {&__pyx_kp_s_SOURCE2_FUNCTION_SIN, __pyx_k_SOURCE2_FUNCTION_SIN, sizeof(__pyx_k_SOURCE2_FUNCTION_SIN), 0, 0, 1, 0},
  {&__pyx_kp_s_SOURCE2_PHASE_ADJUST_90DEG, __pyx_k_SOURCE2_PHASE_ADJUST_90DEG, sizeof(__pyx_k_SOURCE2_PHASE_ADJUST_90DEG), 0, 0, 1, 0},
  {&__pyx_kp_s_SOURCE2_VOLTAGE_AMPLITUDE_1_00, __pyx_k_SOURCE2_VOLTAGE_AMPLITUDE_1_00, sizeof(__pyx_k_SOURCE2_VOLTAGE_AMPLITUDE_1_00), 0, 0, 1, 0},
  {&__pyx_kp_s_SOURCE2_VOLTAGE_OFFSET_0_00, __pyx_k_SOURCE2_VOLTAGE_OFFSET_0_00, sizeof(__pyx_k_SOURCE2_VOLTAGE_OFFSET_0_00), 0, 0, 1, 0},
  {&__pyx_n_s_SPLIT_IN_PROGRESS, __pyx_k_SPLIT_IN_PROGRESS, sizeof(__pyx_k_SPLIT_IN_PROGRESS), 0, 0, 1, 1},
  {&__pyx_n_s_SPLIT_NOT_IN_PROGRESS, __pyx_k_SPLIT_NOT_IN_PROGRESS, sizeof(__pyx_k_SPLIT_NOT_IN_PROGRESS), 0, 0, 1, 1},
  {&__pyx_n_s_SR1, __pyx_k_SR1, sizeof(__pyx_k_SR1), 0, 0, 1, 1},
  {&__pyx_kp_s_SRE, __pyx_k_SRE, sizeof(__pyx_k_SRE), 0, 0, 1, 0},
  {&__pyx_n_s_SRE_2, __pyx_k_SRE_2, sizeof(__pyx_k_SRE_2), 0, 0, 1, 1},
  {&__pyx_kp_s_SRE_d, __pyx_k_SRE_d, sizeof(__pyx_k_SRE_d), 0, 0, 1, 0},
  {&__pyx_n_s_SREmask, __pyx_k_SREmask, sizeof(__pyx_k_SREmask), 0, 0, 1, 1},
  {&__pyx_kp_s_STB, __pyx_k_STB, sizeof(__pyx_k_STB), 0, 0, 1, 0},
  {&__pyx_n_s_STB_2, __pyx_k_STB_2, sizeof(__pyx_k_STB_2), 0, 0, 1, 1},
  {&__pyx_kp_s_STOP, __pyx_k_STOP, sizeof(__pyx_k_STOP), 0, 0, 1, 0},
  {&__pyx_kp_s_STOP_SINGLE_WAV_POINTS_MODE_MAX, __pyx_k_STOP_SINGLE_WAV_POINTS_MODE_MAX, sizeof(__pyx_k_STOP_SINGLE_WAV_POINTS_MODE_MAX), 0, 0, 1, 0},
  {&__pyx_n_s_SUCCESS, __pyx_k_SUCCESS, sizeof(__pyx_k_SUCCESS), 0, 0, 1, 1},
  {&__pyx_n_s_SelectedDeviceClear, __pyx_k_SelectedDeviceClear, sizeof(__pyx_k_SelectedDeviceClear), 0, 0, 1, 1},
  {&__pyx_kp_s_Split_in_progress, __pyx_k_Split_in_progress, sizeof(__pyx_k_Split_in_progress), 0, 0, 1, 0},
  {&__pyx_kp_s_Split_not_in_progress, __pyx_k_Split_not_in_progress, sizeof(__pyx_k_Split_not_in_progress), 0, 0, 1, 0},
  {&__pyx_n_s_StandardFeature, __pyx_k_StandardFeature, sizeof(__pyx_k_StandardFeature), 0, 0, 1, 1},
  {&__pyx_n_s_Success, __pyx_k_Success, sizeof(__pyx_k_Success), 0, 0, 1, 1},
  {&__pyx_kp_s_TER, __pyx_k_TER, sizeof(__pyx_k_TER), 0, 0, 1, 0},
  {&__pyx_n_s_TER_2, __pyx_k_TER_2, sizeof(__pyx_k_TER_2), 0, 0, 1, 1},
  {&__pyx_n_s_TEST_MODE, __pyx_k_TEST_MODE, sizeof(__pyx_k_TEST_MODE), 0, 0, 1, 1},
  {&__pyx_kp_s_TMC_device_must_have_both_Bulk_I, __pyx_k_TMC_device_must_have_both_Bulk_I, sizeof(__pyx_k_TMC_device_must_have_both_Bulk_I), 0, 0, 1, 0},
  {&__pyx_n_s_TRANSFER_NOT_IN_PROGRESS, __pyx_k_TRANSFER_NOT_IN_PROGRESS, sizeof(__pyx_k_TRANSFER_NOT_IN_PROGRESS), 0, 0, 1, 1},
  {&__pyx_n_s_TRG, __pyx_k_TRG, sizeof(__pyx_k_TRG), 0, 0, 1, 1},
  {&__pyx_kp_s_TRG_2, __pyx_k_TRG_2, sizeof(__pyx_k_TRG_2), 0, 0, 1, 0},
  {&__pyx_kp_s_TRIG, __pyx_k_TRIG, sizeof(__pyx_k_TRIG), 0, 0, 1, 0},
  {&__pyx_n_s_TRIGGER, __pyx_k_TRIGGER, sizeof(__pyx_k_TRIGGER), 0, 0, 1, 1},
  {&__pyx_kp_s_TST, __pyx_k_TST, sizeof(__pyx_k_TST), 0, 0, 1, 0},
  {&__pyx_n_s_TST_2, __pyx_k_TST_2, sizeof(__pyx_k_TST_2), 0, 0, 1, 1},
  {&__pyx_n_s_TermChar, __pyx_k_TermChar, sizeof(__pyx_k_TermChar), 0, 0, 1, 1},
  {&__pyx_n_s_TermCharEnable, __pyx_k_TermCharEnable, sizeof(__pyx_k_TermCharEnable), 0, 0, 1, 1},
  {&__pyx_n_s_TransferSize, __pyx_k_TransferSize, sizeof(__pyx_k_TransferSize), 0, 0, 1, 1},
  {&__pyx_kp_s_Transfer_not_in_progress, __pyx_k_Transfer_not_in_progress, sizeof(__pyx_k_Transfer_not_in_progress), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_USB488, __pyx_k_USB488, sizeof(__pyx_k_USB488), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_REQUEST, __pyx_k_USB488_REQUEST, sizeof(__pyx_k_USB488_REQUEST), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_Status, __pyx_k_USB488_Status, sizeof(__pyx_k_USB488_Status), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_Status___init, __pyx_k_USB488_Status___init, sizeof(__pyx_k_USB488_Status___init), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_Status_msg, __pyx_k_USB488_Status_msg, sizeof(__pyx_k_USB488_Status_msg), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_bInterfaceSubClass, __pyx_k_USB488_bInterfaceSubClass, sizeof(__pyx_k_USB488_bInterfaceSubClass), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device, __pyx_k_USB488_device, sizeof(__pyx_k_USB488_device), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_CAL, __pyx_k_USB488_device_CAL, sizeof(__pyx_k_USB488_device_CAL), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_CLS, __pyx_k_USB488_device_CLS, sizeof(__pyx_k_USB488_device_CLS), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_DCL, __pyx_k_USB488_device_DCL, sizeof(__pyx_k_USB488_device_DCL), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_DDT, __pyx_k_USB488_device_DDT, sizeof(__pyx_k_USB488_device_DDT), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_DMC, __pyx_k_USB488_device_DMC, sizeof(__pyx_k_USB488_device_DMC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_EMC, __pyx_k_USB488_device_EMC, sizeof(__pyx_k_USB488_device_EMC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_ESE, __pyx_k_USB488_device_ESE, sizeof(__pyx_k_USB488_device_ESE), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_ESR, __pyx_k_USB488_device_ESR, sizeof(__pyx_k_USB488_device_ESR), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_GMC, __pyx_k_USB488_device_GMC, sizeof(__pyx_k_USB488_device_GMC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_GetExecuteTrigger, __pyx_k_USB488_device_GetExecuteTrigger, sizeof(__pyx_k_USB488_device_GetExecuteTrigger), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_GoToLocal, __pyx_k_USB488_device_GoToLocal, sizeof(__pyx_k_USB488_device_GoToLocal), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_IDN, __pyx_k_USB488_device_IDN, sizeof(__pyx_k_USB488_device_IDN), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_LMC, __pyx_k_USB488_device_LMC, sizeof(__pyx_k_USB488_device_LMC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_LRN, __pyx_k_USB488_device_LRN, sizeof(__pyx_k_USB488_device_LRN), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_LocalLockOut, __pyx_k_USB488_device_LocalLockOut, sizeof(__pyx_k_USB488_device_LocalLockOut), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_OPC, __pyx_k_USB488_device_OPC, sizeof(__pyx_k_USB488_device_OPC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_OPT, __pyx_k_USB488_device_OPT, sizeof(__pyx_k_USB488_device_OPT), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_PSC, __pyx_k_USB488_device_PSC, sizeof(__pyx_k_USB488_device_PSC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_PUD, __pyx_k_USB488_device_PUD, sizeof(__pyx_k_USB488_device_PUD), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_RCL, __pyx_k_USB488_device_RCL, sizeof(__pyx_k_USB488_device_RCL), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_RDT, __pyx_k_USB488_device_RDT, sizeof(__pyx_k_USB488_device_RDT), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_RMC, __pyx_k_USB488_device_RMC, sizeof(__pyx_k_USB488_device_RMC), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_RST, __pyx_k_USB488_device_RST, sizeof(__pyx_k_USB488_device_RST), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_Read_Status_Byte, __pyx_k_USB488_device_Read_Status_Byte, sizeof(__pyx_k_USB488_device_Read_Status_Byte), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_RemoteEnable, __pyx_k_USB488_device_RemoteEnable, sizeof(__pyx_k_USB488_device_RemoteEnable), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_SAD, __pyx_k_USB488_device_SAD, sizeof(__pyx_k_USB488_device_SAD), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_SAV, __pyx_k_USB488_device_SAV, sizeof(__pyx_k_USB488_device_SAV), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_SDS, __pyx_k_USB488_device_SDS, sizeof(__pyx_k_USB488_device_SDS), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_SRE, __pyx_k_USB488_device_SRE, sizeof(__pyx_k_USB488_device_SRE), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_STB, __pyx_k_USB488_device_STB, sizeof(__pyx_k_USB488_device_STB), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_SelectedDeviceClea, __pyx_k_USB488_device_SelectedDeviceClea, sizeof(__pyx_k_USB488_device_SelectedDeviceClea), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_TER, __pyx_k_USB488_device_TER, sizeof(__pyx_k_USB488_device_TER), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_TRG, __pyx_k_USB488_device_TRG, sizeof(__pyx_k_USB488_device_TRG), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_TRIGGER, __pyx_k_USB488_device_TRIGGER, sizeof(__pyx_k_USB488_device_TRIGGER), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_TST, __pyx_k_USB488_device_TST, sizeof(__pyx_k_USB488_device_TST), 0, 0, 1, 1},
  {&__pyx_n_s_USB488_device_WAI, __pyx_k_USB488_device_WAI, sizeof(__pyx_k_USB488_device_WAI), 0, 0, 1, 1},
  {&__pyx_n_s_USBError, __pyx_k_USBError, sizeof(__pyx_k_USBError), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMCError, __pyx_k_USBTMCError, sizeof(__pyx_k_USBTMCError), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_BulkInError, __pyx_k_USBTMC_BulkInError, sizeof(__pyx_k_USBTMC_BulkInError), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_Capabilities, __pyx_k_USBTMC_Capabilities, sizeof(__pyx_k_USBTMC_Capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_Capabilities___init, __pyx_k_USBTMC_Capabilities___init, sizeof(__pyx_k_USBTMC_Capabilities___init), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_Capabilities___str, __pyx_k_USBTMC_Capabilities___str, sizeof(__pyx_k_USBTMC_Capabilities___str), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_DEFAULT_TIMEOUT, __pyx_k_USBTMC_DEFAULT_TIMEOUT, sizeof(__pyx_k_USBTMC_DEFAULT_TIMEOUT), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_MAX_READS_TO_CLEAR_BULK_I, __pyx_k_USBTMC_MAX_READS_TO_CLEAR_BULK_I, sizeof(__pyx_k_USBTMC_MAX_READS_TO_CLEAR_BULK_I), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_MsgID, __pyx_k_USBTMC_MsgID, sizeof(__pyx_k_USBTMC_MsgID), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_REQUEST, __pyx_k_USBTMC_REQUEST, sizeof(__pyx_k_USBTMC_REQUEST), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_SIZE_DEFAULT, __pyx_k_USBTMC_SIZE_DEFAULT, sizeof(__pyx_k_USBTMC_SIZE_DEFAULT), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_SIZE_IOBUFFER, __pyx_k_USBTMC_SIZE_IOBUFFER, sizeof(__pyx_k_USBTMC_SIZE_IOBUFFER), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_Status, __pyx_k_USBTMC_Status, sizeof(__pyx_k_USBTMC_Status), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_Status_msg, __pyx_k_USBTMC_Status_msg, sizeof(__pyx_k_USBTMC_Status_msg), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_bInterfaceClass, __pyx_k_USBTMC_bInterfaceClass, sizeof(__pyx_k_USBTMC_bInterfaceClass), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_bInterfaceProtocol, __pyx_k_USBTMC_bInterfaceProtocol, sizeof(__pyx_k_USBTMC_bInterfaceProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_bInterfaceSubClass, __pyx_k_USBTMC_bInterfaceSubClass, sizeof(__pyx_k_USBTMC_bInterfaceSubClass), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device, __pyx_k_USBTMC_device, sizeof(__pyx_k_USBTMC_device), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device___del, __pyx_k_USBTMC_device___del, sizeof(__pyx_k_USBTMC_device___del), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device___init, __pyx_k_USBTMC_device___init, sizeof(__pyx_k_USBTMC_device___init), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device___init_data, __pyx_k_USBTMC_device___init_data, sizeof(__pyx_k_USBTMC_device___init_data), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_abort_bulk_in, __pyx_k_USBTMC_device_abort_bulk_in, sizeof(__pyx_k_USBTMC_device_abort_bulk_in), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_abort_bulk_out, __pyx_k_USBTMC_device_abort_bulk_out, sizeof(__pyx_k_USBTMC_device_abort_bulk_out), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_ask, __pyx_k_USBTMC_device_ask, sizeof(__pyx_k_USBTMC_device_ask), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_ask0, __pyx_k_USBTMC_device_ask0, sizeof(__pyx_k_USBTMC_device_ask0), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_check_SRQ, __pyx_k_USBTMC_device_check_SRQ, sizeof(__pyx_k_USBTMC_device_check_SRQ), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_check_abort_bulk_i, __pyx_k_USBTMC_device_check_abort_bulk_i, sizeof(__pyx_k_USBTMC_device_check_abort_bulk_i), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_check_abort_bulk_o, __pyx_k_USBTMC_device_check_abort_bulk_o, sizeof(__pyx_k_USBTMC_device_check_abort_bulk_o), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_check_clear_status, __pyx_k_USBTMC_device_check_clear_status, sizeof(__pyx_k_USBTMC_device_check_clear_status), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_clear, __pyx_k_USBTMC_device_clear, sizeof(__pyx_k_USBTMC_device_clear), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_clear_bulk_in_halt, __pyx_k_USBTMC_device_clear_bulk_in_halt, sizeof(__pyx_k_USBTMC_device_clear_bulk_in_halt), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_clear_bulk_out_hal, __pyx_k_USBTMC_device_clear_bulk_out_hal, sizeof(__pyx_k_USBTMC_device_clear_bulk_out_hal), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_clear_halt, __pyx_k_USBTMC_device_clear_halt, sizeof(__pyx_k_USBTMC_device_clear_halt), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_device_read, __pyx_k_USBTMC_device_device_read, sizeof(__pyx_k_USBTMC_device_device_read), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_device_write, __pyx_k_USBTMC_device_device_write, sizeof(__pyx_k_USBTMC_device_device_write), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_find_all, __pyx_k_USBTMC_device_find_all, sizeof(__pyx_k_USBTMC_device_find_all), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_get_capabilities, __pyx_k_USBTMC_device_get_capabilities, sizeof(__pyx_k_USBTMC_device_get_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_getendpoints, __pyx_k_USBTMC_device_getendpoints, sizeof(__pyx_k_USBTMC_device_getendpoints), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_indicator_pulse, __pyx_k_USBTMC_device_indicator_pulse, sizeof(__pyx_k_USBTMC_device_indicator_pulse), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_isUSB488, __pyx_k_USBTMC_device_isUSB488, sizeof(__pyx_k_USBTMC_device_isUSB488), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_read, __pyx_k_USBTMC_device_read, sizeof(__pyx_k_USBTMC_device_read), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_read0, __pyx_k_USBTMC_device_read0, sizeof(__pyx_k_USBTMC_device_read0), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_reset, __pyx_k_USBTMC_device_reset, sizeof(__pyx_k_USBTMC_device_reset), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_usb_get_status, __pyx_k_USBTMC_device_usb_get_status, sizeof(__pyx_k_USBTMC_device_usb_get_status), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_vender_read, __pyx_k_USBTMC_device_vender_read, sizeof(__pyx_k_USBTMC_device_vender_read), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_vender_write, __pyx_k_USBTMC_device_vender_write, sizeof(__pyx_k_USBTMC_device_vender_write), 0, 0, 1, 1},
  {&__pyx_n_s_USBTMC_device_write, __pyx_k_USBTMC_device_write, sizeof(__pyx_k_USBTMC_device_write), 0, 0, 1, 1},
  {&__pyx_kp_s_USBTMC_should_have_at_least_2_en, __pyx_k_USBTMC_should_have_at_least_2_en, sizeof(__pyx_k_USBTMC_should_have_at_least_2_en), 0, 0, 1, 0},
  {&__pyx_n_s_USBTMC_status, __pyx_k_USBTMC_status, sizeof(__pyx_k_USBTMC_status), 0, 0, 1, 1},
  {&__pyx_kp_s_USBTMC_usb_control_msg_returned, __pyx_k_USBTMC_usb_control_msg_returned, sizeof(__pyx_k_USBTMC_usb_control_msg_returned), 0, 0, 1, 0},
  {&__pyx_n_s_USR, __pyx_k_USR, sizeof(__pyx_k_USR), 0, 0, 1, 1},
  {&__pyx_n_s_VENDOR_SPECIFIC_IN, __pyx_k_VENDOR_SPECIFIC_IN, sizeof(__pyx_k_VENDOR_SPECIFIC_IN), 0, 0, 1, 1},
  {&__pyx_n_s_VENDOR_SPECIFIC_OUT, __pyx_k_VENDOR_SPECIFIC_OUT, sizeof(__pyx_k_VENDOR_SPECIFIC_OUT), 0, 0, 1, 1},
  {&__pyx_kp_s_VOLTAGE_AMPLITUDE_2_00, __pyx_k_VOLTAGE_AMPLITUDE_2_00, sizeof(__pyx_k_VOLTAGE_AMPLITUDE_2_00), 0, 0, 1, 0},
  {&__pyx_kp_s_VOLTAGE_OFFSET_1_00, __pyx_k_VOLTAGE_OFFSET_1_00, sizeof(__pyx_k_VOLTAGE_OFFSET_1_00), 0, 0, 1, 0},
  {&__pyx_n_s_VendorSpec_Responce, __pyx_k_VendorSpec_Responce, sizeof(__pyx_k_VendorSpec_Responce), 0, 0, 1, 1},
  {&__pyx_n_s_VendorSpec_Responce___init, __pyx_k_VendorSpec_Responce___init, sizeof(__pyx_k_VendorSpec_Responce___init), 0, 0, 1, 1},
  {&__pyx_kp_s_WAI, __pyx_k_WAI, sizeof(__pyx_k_WAI), 0, 0, 1, 0},
  {&__pyx_n_s_WAI_2, __pyx_k_WAI_2, sizeof(__pyx_k_WAI_2), 0, 0, 1, 1},
  {&__pyx_kp_s_WAV, __pyx_k_WAV, sizeof(__pyx_k_WAV), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_DATA, __pyx_k_WAV_DATA, sizeof(__pyx_k_WAV_DATA), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_FORMAT_BYTE, __pyx_k_WAV_FORMAT_BYTE, sizeof(__pyx_k_WAV_FORMAT_BYTE), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_LENGTH, __pyx_k_WAV_LENGTH, sizeof(__pyx_k_WAV_LENGTH), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_POINTS, __pyx_k_WAV_POINTS, sizeof(__pyx_k_WAV_POINTS), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_POINTS_100000, __pyx_k_WAV_POINTS_100000, sizeof(__pyx_k_WAV_POINTS_100000), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_POINT_s, __pyx_k_WAV_POINT_s, sizeof(__pyx_k_WAV_POINT_s), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_SEND, __pyx_k_WAV_SEND, sizeof(__pyx_k_WAV_SEND), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_SOURCE_CH1, __pyx_k_WAV_SOURCE_CH1, sizeof(__pyx_k_WAV_SOURCE_CH1), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_SOURCE_CH2, __pyx_k_WAV_SOURCE_CH2, sizeof(__pyx_k_WAV_SOURCE_CH2), 0, 0, 1, 0},
  {&__pyx_kp_s_WAV_TRACE_1, __pyx_k_WAV_TRACE_1, sizeof(__pyx_k_WAV_TRACE_1), 0, 0, 1, 0},
  {&__pyx_kp_s_WFMO_BYT_N_1, __pyx_k_WFMO_BYT_N_1, sizeof(__pyx_k_WFMO_BYT_N_1), 0, 0, 1, 0},
  {&__pyx_kp_s_Waveform_from_DPO30xx, __pyx_k_Waveform_from_DPO30xx, sizeof(__pyx_k_Waveform_from_DPO30xx), 0, 0, 1, 0},
  {&__pyx_kp_s_Waveform_from_DPO4034B, __pyx_k_Waveform_from_DPO4034B, sizeof(__pyx_k_Waveform_from_DPO4034B), 0, 0, 1, 0},
  {&__pyx_kp_s_Waveform_from_Yokogawa_SL1000, __pyx_k_Waveform_from_Yokogawa_SL1000, sizeof(__pyx_k_Waveform_from_Yokogawa_SL1000), 0, 0, 1, 0},
  {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
  {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
  {&__pyx_n_s_abort_bulk_in, __pyx_k_abort_bulk_in, sizeof(__pyx_k_abort_bulk_in), 0, 0, 1, 1},
  {&__pyx_n_s_abort_bulk_out, __pyx_k_abort_bulk_out, sizeof(__pyx_k_abort_bulk_out), 0, 0, 1, 1},
  {&__pyx_n_s_aborting, __pyx_k_aborting, sizeof(__pyx_k_aborting), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_ask, __pyx_k_ask, sizeof(__pyx_k_ask), 0, 0, 1, 1},
  {&__pyx_n_s_ask0, __pyx_k_ask0, sizeof(__pyx_k_ask0), 0, 0, 1, 1},
  {&__pyx_n_s_askS, __pyx_k_askS, sizeof(__pyx_k_askS), 0, 0, 1, 1},
  {&__pyx_n_s_attr, __pyx_k_attr, sizeof(__pyx_k_attr), 0, 0, 1, 1},
  {&__pyx_n_s_attribute, __pyx_k_attribute, sizeof(__pyx_k_attribute), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_bEndpointAddress, __pyx_k_bEndpointAddress, sizeof(__pyx_k_bEndpointAddress), 0, 0, 1, 1},
  {&__pyx_n_s_bInterfaceClass, __pyx_k_bInterfaceClass, sizeof(__pyx_k_bInterfaceClass), 0, 0, 1, 1},
  {&__pyx_n_s_bInterfaceProtocol, __pyx_k_bInterfaceProtocol, sizeof(__pyx_k_bInterfaceProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_bInterfaceSubClass, __pyx_k_bInterfaceSubClass, sizeof(__pyx_k_bInterfaceSubClass), 0, 0, 1, 1},
  {&__pyx_n_s_bInterval, __pyx_k_bInterval, sizeof(__pyx_k_bInterval), 0, 0, 1, 1},
  {&__pyx_n_s_bNumEndpoints, __pyx_k_bNumEndpoints, sizeof(__pyx_k_bNumEndpoints), 0, 0, 1, 1},
  {&__pyx_n_s_bRequest, __pyx_k_bRequest, sizeof(__pyx_k_bRequest), 0, 0, 1, 1},
  {&__pyx_n_s_bTag, __pyx_k_bTag, sizeof(__pyx_k_bTag), 0, 0, 1, 1},
  {&__pyx_n_s_bTagInverse, __pyx_k_bTagInverse, sizeof(__pyx_k_bTagInverse), 0, 0, 1, 1},
  {&__pyx_n_s_bTag__lastbtag, __pyx_k_bTag__lastbtag, sizeof(__pyx_k_bTag__lastbtag), 0, 0, 1, 1},
  {&__pyx_n_s_bTag_last, __pyx_k_bTag_last, sizeof(__pyx_k_bTag_last), 0, 0, 1, 1},
  {&__pyx_n_s_bTag_next, __pyx_k_bTag_next, sizeof(__pyx_k_bTag_next), 0, 0, 1, 1},
  {&__pyx_n_s_bcdUSB488, __pyx_k_bcdUSB488, sizeof(__pyx_k_bcdUSB488), 0, 0, 1, 1},
  {&__pyx_n_s_bcdUSBTMC, __pyx_k_bcdUSBTMC, sizeof(__pyx_k_bcdUSBTMC), 0, 0, 1, 1},
  {&__pyx_n_s_bmAttributes, __pyx_k_bmAttributes, sizeof(__pyx_k_bmAttributes), 0, 0, 1, 1},
  {&__pyx_n_s_bmRequestType, __pyx_k_bmRequestType, sizeof(__pyx_k_bmRequestType), 0, 0, 1, 1},
  {&__pyx_n_s_btag, __pyx_k_btag, sizeof(__pyx_k_btag), 0, 0, 1, 1},
  {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1},
  {&__pyx_n_s_build_request_type, __pyx_k_build_request_type, sizeof(__pyx_k_build_request_type), 0, 0, 1, 1},
  {&__pyx_n_s_bulk_in, __pyx_k_bulk_in, sizeof(__pyx_k_bulk_in), 0, 0, 1, 1},
  {&__pyx_n_s_bulk_out, __pyx_k_bulk_out, sizeof(__pyx_k_bulk_out), 0, 0, 1, 1},
  {&__pyx_n_s_byte, __pyx_k_byte, sizeof(__pyx_k_byte), 0, 0, 1, 1},
  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_cPyUSBTMC, __pyx_k_cPyUSBTMC, sizeof(__pyx_k_cPyUSBTMC), 0, 0, 1, 1},
  {&__pyx_kp_s_cPyUSBTMC_pyx, __pyx_k_cPyUSBTMC_pyx, sizeof(__pyx_k_cPyUSBTMC_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_capabilities, __pyx_k_capabilities, sizeof(__pyx_k_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_cfg, __pyx_k_cfg, sizeof(__pyx_k_cfg), 0, 0, 1, 1},
  {&__pyx_n_s_check_SRQ, __pyx_k_check_SRQ, sizeof(__pyx_k_check_SRQ), 0, 0, 1, 1},
  {&__pyx_n_s_check_abort_bulk_in_status, __pyx_k_check_abort_bulk_in_status, sizeof(__pyx_k_check_abort_bulk_in_status), 0, 0, 1, 1},
  {&__pyx_n_s_check_abort_bulk_int_status, __pyx_k_check_abort_bulk_int_status, sizeof(__pyx_k_check_abort_bulk_int_status), 0, 0, 1, 1},
  {&__pyx_n_s_check_abort_bulk_out_status, __pyx_k_check_abort_bulk_out_status, sizeof(__pyx_k_check_abort_bulk_out_status), 0, 0, 1, 1},
  {&__pyx_n_s_check_clear_status, __pyx_k_check_clear_status, sizeof(__pyx_k_check_clear_status), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_clear_bulk_in_halt, __pyx_k_clear_bulk_in_halt, sizeof(__pyx_k_clear_bulk_in_halt), 0, 0, 1, 1},
  {&__pyx_n_s_clear_bulk_out_halt, __pyx_k_clear_bulk_out_halt, sizeof(__pyx_k_clear_bulk_out_halt), 0, 0, 1, 1},
  {&__pyx_n_s_clear_halt, __pyx_k_clear_halt, sizeof(__pyx_k_clear_halt), 0, 0, 1, 1},
  {&__pyx_kp_s_clear_status_failed_too_many_ite, __pyx_k_clear_status_failed_too_many_ite, sizeof(__pyx_k_clear_status_failed_too_many_ite), 0, 0, 1, 0},
  {&__pyx_n_s_clf, __pyx_k_clf, sizeof(__pyx_k_clf), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
  {&__pyx_n_s_cmd, __pyx_k_cmd, sizeof(__pyx_k_cmd), 0, 0, 1, 1},
  {&__pyx_n_s_cnf, __pyx_k_cnf, sizeof(__pyx_k_cnf), 0, 0, 1, 1},
  {&__pyx_n_s_command, __pyx_k_command, sizeof(__pyx_k_command), 0, 0, 1, 1},
  {&__pyx_n_s_control, __pyx_k_control, sizeof(__pyx_k_control), 0, 0, 1, 1},
  {&__pyx_kp_s_convert_return_value_header_to, __pyx_k_convert_return_value_header_to, sizeof(__pyx_k_convert_return_value_header_to), 0, 0, 1, 0},
  {&__pyx_n_s_core, __pyx_k_core, sizeof(__pyx_k_core), 0, 0, 1, 1},
  {&__pyx_n_s_ctrl_transfer, __pyx_k_ctrl_transfer, sizeof(__pyx_k_ctrl_transfer), 0, 0, 1, 1},
  {&__pyx_n_s_custom_match, __pyx_k_custom_match, sizeof(__pyx_k_custom_match), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_or_wLength, __pyx_k_data_or_wLength, sizeof(__pyx_k_data_or_wLength), 0, 0, 1, 1},
  {&__pyx_n_s_default_timeout, __pyx_k_default_timeout, sizeof(__pyx_k_default_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_del, __pyx_k_del, sizeof(__pyx_k_del), 0, 0, 1, 1},
  {&__pyx_n_s_detach_kernel_driver, __pyx_k_detach_kernel_driver, sizeof(__pyx_k_detach_kernel_driver), 0, 0, 1, 1},
  {&__pyx_n_s_dev, __pyx_k_dev, sizeof(__pyx_k_dev), 0, 0, 1, 1},
  {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1},
  {&__pyx_n_s_device_capabilities, __pyx_k_device_capabilities, sizeof(__pyx_k_device_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_device_read, __pyx_k_device_read, sizeof(__pyx_k_device_read), 0, 0, 1, 1},
  {&__pyx_n_s_device_write, __pyx_k_device_write, sizeof(__pyx_k_device_write), 0, 0, 1, 1},
  {&__pyx_n_s_devs, __pyx_k_devs, sizeof(__pyx_k_devs), 0, 0, 1, 1},
  {&__pyx_n_s_direction, __pyx_k_direction, sizeof(__pyx_k_direction), 0, 0, 1, 1},
  {&__pyx_n_s_dispose_resoruce, __pyx_k_dispose_resoruce, sizeof(__pyx_k_dispose_resoruce), 0, 0, 1, 1},
  {&__pyx_n_s_dispose_resources, __pyx_k_dispose_resources, sizeof(__pyx_k_dispose_resources), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_eof, __pyx_k_eof, sizeof(__pyx_k_eof), 0, 0, 1, 1},
  {&__pyx_n_s_eom, __pyx_k_eom, sizeof(__pyx_k_eom), 0, 0, 1, 1},
  {&__pyx_n_s_ep, __pyx_k_ep, sizeof(__pyx_k_ep), 0, 0, 1, 1},
  {&__pyx_n_s_ep_type, __pyx_k_ep_type, sizeof(__pyx_k_ep_type), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
  {&__pyx_n_s_find_all, __pyx_k_find_all, sizeof(__pyx_k_find_all), 0, 0, 1, 1},
  {&__pyx_n_s_find_descriptor, __pyx_k_find_descriptor, sizeof(__pyx_k_find_descriptor), 0, 0, 1, 1},
  {&__pyx_n_s_find_tmc_devices, __pyx_k_find_tmc_devices, sizeof(__pyx_k_find_tmc_devices), 0, 0, 1, 1},
  {&__pyx_n_s_find_tmc_devices_locals_is_usbtm, __pyx_k_find_tmc_devices_locals_is_usbtm, sizeof(__pyx_k_find_tmc_devices_locals_is_usbtm), 0, 0, 1, 1},
  {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1},
  {&__pyx_n_s_get_capabilities, __pyx_k_get_capabilities, sizeof(__pyx_k_get_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_get_status, __pyx_k_get_status, sizeof(__pyx_k_get_status), 0, 0, 1, 1},
  {&__pyx_n_s_getendpoints, __pyx_k_getendpoints, sizeof(__pyx_k_getendpoints), 0, 0, 1, 1},
  {&__pyx_n_s_gp, __pyx_k_gp, sizeof(__pyx_k_gp), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_hl, __pyx_k_hl, sizeof(__pyx_k_hl), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_idVendor, __pyx_k_idVendor, sizeof(__pyx_k_idVendor), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_indicator_pulse, __pyx_k_indicator_pulse, sizeof(__pyx_k_indicator_pulse), 0, 0, 1, 1},
  {&__pyx_kp_s_indicator_pulse_2, __pyx_k_indicator_pulse_2, sizeof(__pyx_k_indicator_pulse_2), 0, 0, 1, 0},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_data, __pyx_k_init_data, sizeof(__pyx_k_init_data), 0, 0, 1, 1},
  {&__pyx_n_s_interface_capabilities, __pyx_k_interface_capabilities, sizeof(__pyx_k_interface_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_intf, __pyx_k_intf, sizeof(__pyx_k_intf), 0, 0, 1, 1},
  {&__pyx_n_s_intr_in, __pyx_k_intr_in, sizeof(__pyx_k_intr_in), 0, 0, 1, 1},
  {&__pyx_n_s_io_timeout, __pyx_k_io_timeout, sizeof(__pyx_k_io_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_isUSB488, __pyx_k_isUSB488, sizeof(__pyx_k_isUSB488), 0, 0, 1, 1},
  {&__pyx_n_s_is_kernel_driver_active, __pyx_k_is_kernel_driver_active, sizeof(__pyx_k_is_kernel_driver_active), 0, 0, 1, 1},
  {&__pyx_n_s_is_usbtmc, __pyx_k_is_usbtmc, sizeof(__pyx_k_is_usbtmc), 0, 0, 1, 1},
  {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
  {&__pyx_n_s_last_read_bTag, __pyx_k_last_read_bTag, sizeof(__pyx_k_last_read_bTag), 0, 0, 1, 1},
  {&__pyx_n_s_last_write_bTag, __pyx_k_last_write_bTag, sizeof(__pyx_k_last_write_bTag), 0, 0, 1, 1},
  {&__pyx_n_s_listen_only, __pyx_k_listen_only, sizeof(__pyx_k_listen_only), 0, 0, 1, 1},
  {&__pyx_kp_s_listen_only_2, __pyx_k_listen_only_2, sizeof(__pyx_k_listen_only_2), 0, 0, 1, 0},
  {&__pyx_n_s_lock_timeout, __pyx_k_lock_timeout, sizeof(__pyx_k_lock_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_maker, __pyx_k_maker, sizeof(__pyx_k_maker), 0, 0, 1, 1},
  {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1},
  {&__pyx_n_s_max_size, __pyx_k_max_size, sizeof(__pyx_k_max_size), 0, 0, 1, 1},
  {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_mkCommonHeader, __pyx_k_mkCommonHeader, sizeof(__pyx_k_mkCommonHeader), 0, 0, 1, 1},
  {&__pyx_n_s_mkDevDepMSGOUTHeader, __pyx_k_mkDevDepMSGOUTHeader, sizeof(__pyx_k_mkDevDepMSGOUTHeader), 0, 0, 1, 1},
  {&__pyx_n_s_mkReqDevDepMSGINHeader, __pyx_k_mkReqDevDepMSGINHeader, sizeof(__pyx_k_mkReqDevDepMSGINHeader), 0, 0, 1, 1},
  {&__pyx_n_s_mkReqVendorSpecMSGINHeader, __pyx_k_mkReqVendorSpecMSGINHeader, sizeof(__pyx_k_mkReqVendorSpecMSGINHeader), 0, 0, 1, 1},
  {&__pyx_n_s_mkTriggerHeader, __pyx_k_mkTriggerHeader, sizeof(__pyx_k_mkTriggerHeader), 0, 0, 1, 1},
  {&__pyx_n_s_mkVendorSpecMSGOUTHeader, __pyx_k_mkVendorSpecMSGOUTHeader, sizeof(__pyx_k_mkVendorSpecMSGOUTHeader), 0, 0, 1, 1},
  {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_n_s_msgID, __pyx_k_msgID, sizeof(__pyx_k_msgID), 0, 0, 1, 1},
  {&__pyx_n_s_msgid, __pyx_k_msgid, sizeof(__pyx_k_msgid), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
  {&__pyx_n_s_ndata, __pyx_k_ndata, sizeof(__pyx_k_ndata), 0, 0, 1, 1},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_num_endpoints, __pyx_k_num_endpoints, sizeof(__pyx_k_num_endpoints), 0, 0, 1, 1},
  {&__pyx_n_s_plot, __pyx_k_plot, sizeof(__pyx_k_plot), 0, 0, 1, 1},
  {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_pylab, __pyx_k_pylab, sizeof(__pyx_k_pylab), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_raw, __pyx_k_raw, sizeof(__pyx_k_raw), 0, 0, 1, 1},
  {&__pyx_n_s_raw_resp, __pyx_k_raw_resp, sizeof(__pyx_k_raw_resp), 0, 0, 1, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_s_read0, __pyx_k_read0, sizeof(__pyx_k_read0), 0, 0, 1, 1},
  {&__pyx_n_s_readS, __pyx_k_readS, sizeof(__pyx_k_readS), 0, 0, 1, 1},
  {&__pyx_kp_s_read_d_bytes_in_f_seconds_f_byte, __pyx_k_read_d_bytes_in_f_seconds_f_byte, sizeof(__pyx_k_read_d_bytes_in_f_seconds_f_byte), 0, 0, 1, 0},
  {&__pyx_n_s_recipient, __pyx_k_recipient, sizeof(__pyx_k_recipient), 0, 0, 1, 1},
  {&__pyx_n_s_remaining, __pyx_k_remaining, sizeof(__pyx_k_remaining), 0, 0, 1, 1},
  {&__pyx_n_s_requestSize, __pyx_k_requestSize, sizeof(__pyx_k_requestSize), 0, 0, 1, 1},
  {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  {&__pyx_n_s_resMsg, __pyx_k_resMsg, sizeof(__pyx_k_resMsg), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_resp, __pyx_k_resp, sizeof(__pyx_k_resp), 0, 0, 1, 1},
  {&__pyx_n_s_retry_buf, __pyx_k_retry_buf, sizeof(__pyx_k_retry_buf), 0, 0, 1, 1},
  {&__pyx_n_s_rsize, __pyx_k_rsize, sizeof(__pyx_k_rsize), 0, 0, 1, 1},
  {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_1c_1c_1c_1c, __pyx_k_s_1c_1c_1c_1c, sizeof(__pyx_k_s_1c_1c_1c_1c), 0, 0, 1, 0},
  {&__pyx_kp_s_s_1c_1c_1c_1c_1c, __pyx_k_s_1c_1c_1c_1c_1c, sizeof(__pyx_k_s_1c_1c_1c_1c_1c), 0, 0, 1, 0},
  {&__pyx_kp_s_s_1c_1c_1c_1c_1c_2, __pyx_k_s_1c_1c_1c_1c_1c_2, sizeof(__pyx_k_s_1c_1c_1c_1c_1c_2), 0, 0, 1, 0},
  {&__pyx_kp_s_s_1c_1c_1c_1c_2, __pyx_k_s_1c_1c_1c_1c_2, sizeof(__pyx_k_s_1c_1c_1c_1c_2), 0, 0, 1, 0},
  {&__pyx_n_s_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 0, 1, 1},
  {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_s, __pyx_k_s_s_s, sizeof(__pyx_k_s_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_sb, __pyx_k_sb, sizeof(__pyx_k_sb), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_set_configuration, __pyx_k_set_configuration, sizeof(__pyx_k_set_configuration), 0, 0, 1, 1},
  {&__pyx_n_s_set_interface_altsetting, __pyx_k_set_interface_altsetting, sizeof(__pyx_k_set_interface_altsetting), 0, 0, 1, 1},
  {&__pyx_n_s_show, __pyx_k_show, sizeof(__pyx_k_show), 0, 0, 1, 1},
  {&__pyx_n_s_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 0, 1, 1},
  {&__pyx_kp_s_size_of_waveform_s, __pyx_k_size_of_waveform_s, sizeof(__pyx_k_size_of_waveform_s), 0, 0, 1, 0},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_s_sn, __pyx_k_sn, sizeof(__pyx_k_sn), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_statusBytes, __pyx_k_statusBytes, sizeof(__pyx_k_statusBytes), 0, 0, 1, 1},
  {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_talk_only, __pyx_k_talk_only, sizeof(__pyx_k_talk_only), 0, 0, 1, 1},
  {&__pyx_kp_s_talk_only_2, __pyx_k_talk_only_2, sizeof(__pyx_k_talk_only_2), 0, 0, 1, 0},
  {&__pyx_n_s_termChar, __pyx_k_termChar, sizeof(__pyx_k_termChar), 0, 0, 1, 1},
  {&__pyx_n_s_termCharFlag, __pyx_k_termCharFlag, sizeof(__pyx_k_termCharFlag), 0, 0, 1, 1},
  {&__pyx_n_s_term_char, __pyx_k_term_char, sizeof(__pyx_k_term_char), 0, 0, 1, 1},
  {&__pyx_n_s_term_char_enabled, __pyx_k_term_char_enabled, sizeof(__pyx_k_term_char_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_termchar, __pyx_k_termchar, sizeof(__pyx_k_termchar), 0, 0, 1, 1},
  {&__pyx_n_s_termchar_enable, __pyx_k_termchar_enable, sizeof(__pyx_k_termchar_enable), 0, 0, 1, 1},
  {&__pyx_kp_s_termchar_enable_2, __pyx_k_termchar_enable_2, sizeof(__pyx_k_termchar_enable_2), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1},
  {&__pyx_kp_s_the_device_is_not_USBTMC_USB488, __pyx_k_the_device_is_not_USBTMC_USB488, sizeof(__pyx_k_the_device_is_not_USBTMC_USB488), 0, 0, 1, 0},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_title, __pyx_k_title, sizeof(__pyx_k_title), 0, 0, 1, 1},
  {&__pyx_n_s_tmcdev, __pyx_k_tmcdev, sizeof(__pyx_k_tmcdev), 0, 0, 1, 1},
  {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
  {&__pyx_n_s_transferSize, __pyx_k_transferSize, sizeof(__pyx_k_transferSize), 0, 0, 1, 1},
  {&__pyx_n_s_tsize, __pyx_k_tsize, sizeof(__pyx_k_tsize), 0, 0, 1, 1},
  {&__pyx_n_s_usb, __pyx_k_usb, sizeof(__pyx_k_usb), 0, 0, 1, 1},
  {&__pyx_n_s_usb488_device_capabilities, __pyx_k_usb488_device_capabilities, sizeof(__pyx_k_usb488_device_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_usb488_interface_capabilities, __pyx_k_usb488_interface_capabilities, sizeof(__pyx_k_usb488_interface_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_usb_control, __pyx_k_usb_control, sizeof(__pyx_k_usb_control), 0, 0, 1, 1},
  {&__pyx_n_s_usb_core, __pyx_k_usb_core, sizeof(__pyx_k_usb_core), 0, 0, 1, 1},
  {&__pyx_n_s_usb_get_status, __pyx_k_usb_get_status, sizeof(__pyx_k_usb_get_status), 0, 0, 1, 1},
  {&__pyx_n_s_usb_util, __pyx_k_usb_util, sizeof(__pyx_k_usb_util), 0, 0, 1, 1},
  {&__pyx_n_s_usbctrl, __pyx_k_usbctrl, sizeof(__pyx_k_usbctrl), 0, 0, 1, 1},
  {&__pyx_n_s_usbdev, __pyx_k_usbdev, sizeof(__pyx_k_usbdev), 0, 0, 1, 1},
  {&__pyx_n_s_usbdevs, __pyx_k_usbdevs, sizeof(__pyx_k_usbdevs), 0, 0, 1, 1},
  {&__pyx_n_s_usbtmc_attribute, __pyx_k_usbtmc_attribute, sizeof(__pyx_k_usbtmc_attribute), 0, 0, 1, 1},
  {&__pyx_n_s_usbtmc_attribute___init, __pyx_k_usbtmc_attribute___init, sizeof(__pyx_k_usbtmc_attribute___init), 0, 0, 1, 1},
  {&__pyx_n_s_usbtmc_dev_capabilities, __pyx_k_usbtmc_dev_capabilities, sizeof(__pyx_k_usbtmc_dev_capabilities), 0, 0, 1, 1},
  {&__pyx_n_s_usbtmc_dev_capabilities___init, __pyx_k_usbtmc_dev_capabilities___init, sizeof(__pyx_k_usbtmc_dev_capabilities___init), 0, 0, 1, 1},
  {&__pyx_n_s_util, __pyx_k_util, sizeof(__pyx_k_util), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_vender_read, __pyx_k_vender_read, sizeof(__pyx_k_vender_read), 0, 0, 1, 1},
  {&__pyx_n_s_vender_write, __pyx_k_vender_write, sizeof(__pyx_k_vender_write), 0, 0, 1, 1},
  {&__pyx_n_s_vers, __pyx_k_vers, sizeof(__pyx_k_vers), 0, 0, 1, 1},
  {&__pyx_n_s_wIndex, __pyx_k_wIndex, sizeof(__pyx_k_wIndex), 0, 0, 1, 1},
  {&__pyx_n_s_wMaxPacketSize, __pyx_k_wMaxPacketSize, sizeof(__pyx_k_wMaxPacketSize), 0, 0, 1, 1},
  {&__pyx_n_s_wValue, __pyx_k_wValue, sizeof(__pyx_k_wValue), 0, 0, 1, 1},
  {&__pyx_n_s_wf, __pyx_k_wf, sizeof(__pyx_k_wf), 0, 0, 1, 1},
  {&__pyx_n_s_wf2, __pyx_k_wf2, sizeof(__pyx_k_wf2), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_x0, __pyx_k_x0, sizeof(__pyx_k_x0), 0, 0, 1, 1},
  {&__pyx_n_s_xlabel, __pyx_k_xlabel, sizeof(__pyx_k_xlabel), 0, 0, 1, 1},
  {&__pyx_n_s_ylabel, __pyx_k_ylabel, sizeof(__pyx_k_ylabel), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 1041, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 1166, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cPyUSBTMC.pyx":78
 *     value from this function.  The user can use USBTMC_device.find_all() and USB488_device.find_all().
 *     """
 *     def is_usbtmc(d):             # <<<<<<<<<<<<<<
 *         for cfg in d:
 *             # USBTMC_bInterfaceClass = 0xfe, USBTMC_bInterfaceSubClass = 3
 */
  __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_s_d, __pyx_n_s_cfg); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
  __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_is_usbtmc, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 78, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1031
 *         self.bTag=bytes[1]
 *         self.bTagInverse=bytes[2]
 *         self.resMsg=bytes[4:12]             # <<<<<<<<<<<<<<
 *         try:
 *             self.data=bytes[12:]
 */
  __pyx_slice__6 = PySlice_New(__pyx_int_4, __pyx_int_12, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__6);
  __Pyx_GIVEREF(__pyx_slice__6);

  /* "cPyUSBTMC.pyx":1033
 *         self.resMsg=bytes[4:12]
 *         try:
 *             self.data=bytes[12:]             # <<<<<<<<<<<<<<
 *         except:
 *             self.data=None
 */
  __pyx_slice__7 = PySlice_New(__pyx_int_12, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 1033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__7);
  __Pyx_GIVEREF(__pyx_slice__7);

  /* "cPyUSBTMC.pyx":1068
 *             self.SBR=IEEE488_Status_Byte_Reg(bytes[1])
 *         elif (bytes[0] & 0x40): # vendor specific
 *             self.statusBytes=bytes[1:]             # <<<<<<<<<<<<<<
 *         else:
 *             self.statusBytes=bytes[1:]
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "cPyUSBTMC.pyx":1130
 *     n,d=dev.ask(":WAV:POINTS?\n")
 *     sys.stdout.write("WAV:POINT = %s \n"%d.tostring())
 *     n,wf=dev.ask(":WAV:DATA?",requestSize=20000000)             # <<<<<<<<<<<<<<
 *     sys.stdout.write("size of waveform %s \n",n)
 * 
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_WAV_DATA); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "cPyUSBTMC.pyx":1138
 *     gp=Gnuplot.Gnuplot()
 *     gp.title("Python USBTMC module example \\n from %s"%model)
 *     hl=int(wf[1:2].tostring())+2             # <<<<<<<<<<<<<<
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])
 *     x0=wf[-1]
 */
  __pyx_slice__11 = PySlice_New(__pyx_int_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__11)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__11);
  __Pyx_GIVEREF(__pyx_slice__11);

  /* "cPyUSBTMC.pyx":1139
 *     gp.title("Python USBTMC module example \\n from %s"%model)
 *     hl=int(wf[1:2].tostring())+2
 *     gp.plot(wf[hl:-2][::10],wf2[hl:-2][::10])             # <<<<<<<<<<<<<<
 *     x0=wf[-1]
 *     return dev
 */
  __pyx_slice__12 = PySlice_New(Py_None, Py_None, __pyx_int_10); if (unlikely(!__pyx_slice__12)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__12);
  __Pyx_GIVEREF(__pyx_slice__12);

  /* "cPyUSBTMC.pyx":1189
 *     pylab.ylabel("signal")
 *     pylab.title("Waveform from DPO4034B")
 *     pylab.plot(wf[hl:-1][::100])             # <<<<<<<<<<<<<<
 *     pylab.show(False)
 *     return dev
 */
  __pyx_slice__13 = PySlice_New(Py_None, Py_None, __pyx_int_100); if (unlikely(!__pyx_slice__13)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__13);
  __Pyx_GIVEREF(__pyx_slice__13);

  /* "cPyUSBTMC.pyx":70
 * # it means 'use "<" in pack/unpack of struct module.'
 * 
 * def find_tmc_devices():             # <<<<<<<<<<<<<<
 *     """
 *     get the list of USB devices which belongs USBTMC Class.
 */
  __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_is_usbtmc, __pyx_n_s_is_usbtmc, __pyx_n_s_devs); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_find_tmc_devices, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 70, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":98
 * #
 * class usbtmc_dev_capabilities:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.interface_capabilities=""
 *         self.device_capabilities=""
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 98, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":105
 * 
 * class usbtmc_attribute:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.attribute=0
 *         self.value=0
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 105, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":121
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.SUCCESS):
 *             return "Success"
 */
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_i); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_msg, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 121, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":137
 * #
 * class IEEE488_Status_Byte_Reg:
 *     def __init__(self,byte):             # <<<<<<<<<<<<<<
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_byte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 137, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":150
 *     INTERRUPT_IN_BUSY=0x20
 * 
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 150, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":156
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.INTERRUPT_IN_BUSY):
 *             return "Interrupt in busy"
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_i); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_msg, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 156, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":195
 *     #
 *     @classmethod
 *     def find_all(cls):             # <<<<<<<<<<<<<<
 *         usbdevs=find_tmc_devices()
 *         return [cls(dev) for dev in usbdevs]
 */
  __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_usbdevs, __pyx_n_s_dev); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_find_all, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":199
 *         return [cls(dev) for dev in usbdevs]
 * 
 *     def __init__(self,device):             # <<<<<<<<<<<<<<
 *         # device:usb.core.Device
 *         self.device=device
 */
  __pyx_tuple__31 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_device, __pyx_n_s_cnf, __pyx_n_s_intf); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 199, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":224
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 * 
 *     def __init_data__(self):             # <<<<<<<<<<<<<<
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init_data, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 224, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":233
 *         self.term_char="\n"
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_del, 233, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 233, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":257
 *         return
 * 
 *     def getendpoints(self, cnf, intf):             # <<<<<<<<<<<<<<
 *         self.intf = intf
 *         #intf.set_altsetting()
 */
  __pyx_tuple__37 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_cnf, __pyx_n_s_intf, __pyx_n_s_num_endpoints, __pyx_n_s_ep, __pyx_n_s_attr, __pyx_n_s_direction, __pyx_n_s_ep_type); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_getendpoints, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 257, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":290
 * 
 * 
 *     def isUSB488(self):             # <<<<<<<<<<<<<<
 *         if (self.intf.bInterfaceProtocol == 1):
 *             return True
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_isUSB488, 290, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 290, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":296
 *             return False
 * 
 *     def usb_get_status(self,recipient=None):             # <<<<<<<<<<<<<<
 *         """
 *         recipient can be None(default) or Interfae or endpoint.
 */
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_recipient); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_usb_get_status, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 296, __pyx_L1_error)
  __pyx_tuple__43 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "cPyUSBTMC.pyx":306
 *         return  usb.control.get_status(self.device, recipient)
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         return self.device.reset()
 * 
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_reset, 306, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 306, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":309
 *         return self.device.reset()
 * 
 *     def clear_halt(self):             # <<<<<<<<<<<<<<
 *         """
 *         re-establish synchronization in all end-points.
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_clear_halt, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 309, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":318
 *             self.intr_in.clear_halt()
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,             # <<<<<<<<<<<<<<
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):
 *         """
 */
  __pyx_tuple__48 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_cmd, __pyx_n_s_requestSize, __pyx_n_s_termChar, __pyx_n_s_termCharFlag, __pyx_n_s_io_timeout); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_ask0, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 318, __pyx_L1_error)
  __pyx_tuple__50 = PyTuple_Pack(5, ((PyObject*)__pyx_kp_s_IDN), ((PyObject *)__pyx_int_0), ((PyObject*)__pyx_kp_s__4), ((PyObject *)Py_True), ((PyObject *)__pyx_int_1000)); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "cPyUSBTMC.pyx":330
 *                           , requestSize = requestSize)
 * 
 *     def ask(self, cmd="*IDN?\n",             # <<<<<<<<<<<<<<
 *             requestSize=0,
 *             termChar="\n",
 */
  __pyx_tuple__51 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_cmd, __pyx_n_s_requestSize, __pyx_n_s_termChar, __pyx_n_s_termCharFlag, __pyx_n_s_io_timeout, __pyx_n_s_data); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_ask, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 330, __pyx_L1_error)
  __pyx_tuple__53 = PyTuple_Pack(5, ((PyObject*)__pyx_kp_s_IDN), ((PyObject *)__pyx_int_0), ((PyObject*)__pyx_kp_s__4), ((PyObject *)Py_True), ((PyObject *)__pyx_int_1000)); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "cPyUSBTMC.pyx":350
 *     askS=ask
 * 
 *     def read(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *              , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */
  __pyx_tuple__54 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_requestSize, __pyx_n_s_io_timeout, __pyx_n_s_lock_timeout, __pyx_n_s_flag, __pyx_n_s_termChar, __pyx_n_s_data, __pyx_n_s_ndata, __pyx_n_s_eom, __pyx_n_s_rsize, __pyx_n_s_termCharFlag, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_read, 350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 350, __pyx_L1_error)
  __pyx_tuple__56 = PyTuple_Pack(5, ((PyObject *)__pyx_int_0), ((PyObject *)__pyx_int_1000), ((PyObject *)__pyx_int_0), ((PyObject *)Py_False), ((PyObject*)__pyx_kp_s__5)); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "cPyUSBTMC.pyx":379
 *     readS=read
 * 
 *     def read0(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *               , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */
  __pyx_tuple__57 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_requestSize, __pyx_n_s_io_timeout, __pyx_n_s_lock_timeout, __pyx_n_s_flag, __pyx_n_s_termChar, __pyx_n_s_data, __pyx_n_s_ndata, __pyx_n_s_eom, __pyx_n_s_rsize, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_read0, 379, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 379, __pyx_L1_error)
  __pyx_tuple__59 = PyTuple_Pack(5, ((PyObject *)__pyx_int_0), ((PyObject *)__pyx_int_1000), ((PyObject *)__pyx_int_0), ((PyObject *)Py_False), ((PyObject*)__pyx_kp_s__5)); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "cPyUSBTMC.pyx":402
 *         return (ndata,data)
 * 
 *     def write(self, cmd="*IDN?\n"):             # <<<<<<<<<<<<<<
 *         return self.device_write(cmd)
 * 
 */
  __pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_cmd); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_write, 402, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 402, __pyx_L1_error)
  __pyx_tuple__62 = PyTuple_Pack(1, ((PyObject*)__pyx_kp_s_IDN)); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "cPyUSBTMC.pyx":405
 *         return self.device_write(cmd)
 * 
 *     def device_write(self,  message):             # <<<<<<<<<<<<<<
 *         remaining=len(message)
 *         while (remaining > 0):
 */
  __pyx_tuple__63 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_remaining, __pyx_n_s_eom, __pyx_n_s_transferSize, __pyx_n_s_t, __pyx_n_s_h, __pyx_n_s_command); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_device_write, 405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 405, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":434
 *         return
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,             # <<<<<<<<<<<<<<
 *                     termCharFlag=False,
 *                     termchar="\0", timeout=1000):
 */
  __pyx_tuple__65 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_transferSize, __pyx_n_s_termCharFlag, __pyx_n_s_termchar, __pyx_n_s_timeout, __pyx_n_s_ndata, __pyx_n_s_btag, __pyx_n_s_buf, __pyx_n_s_raw_resp, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_device_read, 434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 434, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":460
 *         return resp
 * 
 *     def vender_write(self,message):             # <<<<<<<<<<<<<<
 *         """
 *         Vender specific bulk write method. Should be
 */
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_message); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_vender_write, 460, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 460, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":466
 *         raise USBTMCError("Not Implemented")
 * 
 *     def vender_read(self,maxsize=None):             # <<<<<<<<<<<<<<
 *         raise USBTMCError("Not Implemented")
 * 
 */
  __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_maxsize); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_vender_read, 466, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 466, __pyx_L1_error)
  __pyx_tuple__71 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "cPyUSBTMC.pyx":469
 *         raise USBTMCError("Not Implemented")
 * 
 *     def check_SRQ(self):             # <<<<<<<<<<<<<<
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)
 *         sb=Interrupt_IN_Data(rv)
 */
  __pyx_tuple__72 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_rv, __pyx_n_s_sb); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_check_SRQ, 469, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 469, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":498
 *     value is the data payload read, as an array object."""
 * 
 *     def abort_bulk_out(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type
 */
  __pyx_tuple__74 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_abort_bulk_out, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 498, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":522
 *             raise USBTMCError("Initiate abort_bulk_out failed")
 * 
 *     def check_abort_bulk_out_status(self):             # <<<<<<<<<<<<<<
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */
  __pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_check_abort_bulk_out_status, 522, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 522, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":533
 *         return rv
 * 
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4             # <<<<<<<<<<<<<<
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */
  __pyx_tuple__78 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_clear_bulk_out_halt, 533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 533, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":547
 *         return rv
 * 
 *     def abort_bulk_in(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type
 */
  __pyx_tuple__80 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_abort_bulk_in, 547, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 547, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":569
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])
 * 
 *     def check_abort_bulk_in_status(self):             # <<<<<<<<<<<<<<
 *         n=0
 *         max_size=self.bulk_in.wMaxPacketSize
 */
  __pyx_tuple__82 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_max_size, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_check_abort_bulk_in_status, 569, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 569, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":592
 *         return rv
 * 
 *     def clear_bulk_in_halt(self):#USBTMC 3.3.2.4/4.1.1.2             # <<<<<<<<<<<<<<
 *         # rv=usb.control.clear_feature(self.device, usb.control.ENDPOINT_HALT,
 *         #                              self.bulk_in.bEndpointAddress)
 */
  __pyx_tuple__84 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_clear_bulk_in_halt, 592, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 592, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":606
 * 
 *     #
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(
 */
  __pyx_tuple__86 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_rv, __pyx_n_s_n); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_clear, 606, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 606, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":629
 *         return rv
 * 
 *     def check_clear_status(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_tuple__88 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_check_clear_status, 629, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 629, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":640
 *         return rv
 * 
 *     def get_capabilities(self):             # <<<<<<<<<<<<<<
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(
 */
  __pyx_tuple__90 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);
  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_get_capabilities, 640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 640, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":654
 *         return None
 * 
 *     def indicator_pulse(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 */
  __pyx_tuple__92 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_indicator_pulse, 654, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 654, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":668
 * class USB488_device(USBTMC_device):
 *     #mandatory commands
 *     def CLS(self):             # <<<<<<<<<<<<<<
 *         self.write("*CLS\n")
 * 
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_CLS_2, 668, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 668, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":671
 *         self.write("*CLS\n")
 * 
 *     def ESE(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*ESE?;\n")
 */
  __pyx_tuple__96 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);
  __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_ESE_3, 671, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 671, __pyx_L1_error)
  __pyx_tuple__98 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "cPyUSBTMC.pyx":677
 *             self.write("*ESE;\n")
 * 
 *     def ESR(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*ESQ?;\n")
 * 
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_ESR, 677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 677, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":680
 *         return self.ask("*ESQ?;\n")
 * 
 *     def IDN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*IDN?;\n")
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_IDN_4, 680, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 680, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":683
 *         return self.ask("*IDN?;\n")
 * 
 *     def OPC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*OPC?;\n")
 */
  __pyx_tuple__103 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_OPC_3, 683, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 683, __pyx_L1_error)
  __pyx_tuple__105 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "cPyUSBTMC.pyx":689
 *             self.write("*OPC;\n")
 * 
 *     def RST(self):             # <<<<<<<<<<<<<<
 *         self.write("*RST;\n")
 * 
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_RST_3, 689, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 689, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":692
 *         self.write("*RST;\n")
 * 
 *     def SRE(self,mask=None):             # <<<<<<<<<<<<<<
 *         if mask == None:
 *             return self.ask("*SRE?;\n")
 */
  __pyx_tuple__108 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_mask); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SRE_2, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 692, __pyx_L1_error)
  __pyx_tuple__110 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);

  /* "cPyUSBTMC.pyx":698
 *             self.write("*SRE %d;\n"%mask)
 * 
 *     def STB(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*STB?;\n")
 * 
 */
  __pyx_tuple__111 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_STB_2, 698, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(0, 698, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":701
 *         return self.ask("*STB?;\n")
 * 
 *     def TRG(self):             # <<<<<<<<<<<<<<
 *         self.write("*TRG\n")
 * 
 */
  __pyx_tuple__113 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_TRG, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 701, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":704
 *         self.write("*TRG\n")
 * 
 *     def TST(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TST?\n")
 * 
 */
  __pyx_tuple__115 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_TST_2, 704, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 704, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":707
 *         return self.ask("*TST?\n")
 * 
 *     def WAI(self):             # <<<<<<<<<<<<<<
 *         self.write("*WAI\n")
 * 
 */
  __pyx_tuple__117 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_WAI_2, 707, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(0, 707, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":712
 *     # optional commands
 * 
 *     def CAL(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
  __pyx_tuple__119 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_CAL_2, 712, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(0, 712, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":717
 *         return self.ask("*CAL?\n")
 * 
 *     def DDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*DDT?\n")
 */
  __pyx_tuple__121 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DDT_3, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 717, __pyx_L1_error)
  __pyx_tuple__123 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "cPyUSBTMC.pyx":723
 *             self.write("*DDT\n")
 * 
 *     def DMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*DMC\n")
 * 
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DMC_2, 723, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 723, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":726
 *         self.write("*DMC\n")
 * 
 *     def EMC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*EMC?\n")
 */
  __pyx_tuple__126 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_EMC_3, 726, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 726, __pyx_L1_error)
  __pyx_tuple__128 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);

  /* "cPyUSBTMC.pyx":731
 *         else:
 *             self.write("*EMC\n")
 *     def GMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*GMC?\n")
 * 
 */
  __pyx_tuple__129 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_GMC_2, 731, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 731, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":734
 *         return self.ask("*GMC?\n")
 * 
 *     def LMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LMC?\n")
 * 
 */
  __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_LMC_2, 734, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 734, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":737
 *         return self.ask("*LMC?\n")
 * 
 *     def LRN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LRN?\n")
 * 
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_LRN_2, 737, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 737, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":740
 *         return self.ask("*LRN?\n")
 * 
 *     def PSC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*PSC?\n")
 */
  __pyx_tuple__135 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);
  __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_PSC_3, 740, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(0, 740, __pyx_L1_error)
  __pyx_tuple__137 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);

  /* "cPyUSBTMC.pyx":746
 *             self.write("*PSC\n")
 * 
 *     def PUD(self):             # <<<<<<<<<<<<<<
 *         self.write("*PUD\n")
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_PUD_2, 746, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 746, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":749
 *         self.write("*PUD\n")
 * 
 *     def RCL(self):             # <<<<<<<<<<<<<<
 *         self.write("*RCL\n")
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_RCL_2, 749, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 749, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":752
 *         self.write("*RCL\n")
 * 
 *     def RDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*RDT?\n")
 */
  __pyx_tuple__142 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_query); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_RDT_3, 752, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 752, __pyx_L1_error)
  __pyx_tuple__144 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);

  /* "cPyUSBTMC.pyx":758
 *             self.write("*RDT")
 * 
 *     def RMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*RMC\n")
 * 
 */
  __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_RMC_2, 758, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 758, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":761
 *         self.write("*RMC\n")
 * 
 *     def SAV(self):             # <<<<<<<<<<<<<<
 *         self.write("*SAV\n")
 * 
 */
  __pyx_tuple__147 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);
  __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SAV_2, 761, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(0, 761, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":764
 *         self.write("*SAV\n")
 * 
 *     def SAD(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 * 
 */
  __pyx_tuple__149 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__149);
  __Pyx_GIVEREF(__pyx_tuple__149);
  __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SAD, 764, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 764, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":767
 *         self.write("*SDS")
 * 
 *     def SDS(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 *     #
 */
  __pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__151);
  __Pyx_GIVEREF(__pyx_tuple__151);
  __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SDS_2, 767, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 767, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":770
 *         self.write("*SDS")
 *     #
 *     def OPT(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*OPT?\n")
 * 
 */
  __pyx_tuple__153 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__153);
  __Pyx_GIVEREF(__pyx_tuple__153);
  __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_OPT_2, 770, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 770, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":773
 *         return self.ask("*OPT?\n")
 * 
 *     def TER(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TER?\n")
 *     #
 */
  __pyx_tuple__155 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__155);
  __Pyx_GIVEREF(__pyx_tuple__155);
  __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_TER_2, 773, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 773, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":776
 *         return self.ask("*TER?\n")
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15             # <<<<<<<<<<<<<<
 *         if enable:
 *             b=self.device.ctrl_transfer(
 */
  __pyx_tuple__157 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_enable, __pyx_n_s_b); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__157);
  __Pyx_GIVEREF(__pyx_tuple__157);
  __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_RemoteEnable, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(0, 776, __pyx_L1_error)
  __pyx_tuple__159 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__159)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__159);
  __Pyx_GIVEREF(__pyx_tuple__159);

  /* "cPyUSBTMC.pyx":798
 *         return b #USBTMC_Status
 * 
 *     def LocalLockOut(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_tuple__160 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);
  __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_LocalLockOut, 798, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(0, 798, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":809
 *         return b #USBTMC_Status
 * 
 *     def GoToLocal(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_tuple__162 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__162);
  __Pyx_GIVEREF(__pyx_tuple__162);
  __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_GoToLocal, 809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 809, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":820
 *         return b #USBTMC_Status
 * 
 *     def Read_Status_Byte(self):             # <<<<<<<<<<<<<<
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(
 */
  __pyx_tuple__164 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_b, __pyx_n_s_sb, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);
  __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_Read_Status_Byte, 820, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(0, 820, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":838
 *             return USB488_Status(b)
 * 
 *     def TRIGGER(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 */
  __pyx_tuple__166 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);
  __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_TRIGGER, 838, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(0, 838, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":849
 *                 raise
 * 
 *     def GetExecuteTrigger(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             self.TRIGGER()
 */
  __pyx_tuple__168 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_GetExecuteTrigger, 849, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 849, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":855
 *             self.TRG()
 * 
 *     def SelectedDeviceClear(self):#table 26             # <<<<<<<<<<<<<<
 *         self.clear()
 * 
 */
  __pyx_tuple__170 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);
  __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SelectedDeviceClear, 855, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 855, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":863
 *     #         ent.clear()
 * 
 *     def DCL(self):             # <<<<<<<<<<<<<<
 *         """
 *         send DCL(Device CLear)
 */
  __pyx_tuple__172 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);
  __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DCL_2, 863, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 863, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":876
 * 
 * class USBTMC_Capabilities:
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):
 */
  __pyx_tuple__174 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 876, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 876, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":933
 *                 self.DT1=False
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         msg=""
 *         if self.indicator_pulse:
 */
  __pyx_tuple__176 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);
  __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_str, 933, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(0, 933, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":949
 *     __lastbtag=0
 *     @classmethod
 *     def next(cls):             # <<<<<<<<<<<<<<
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)
 */
  __pyx_tuple__178 = PyTuple_Pack(1, __pyx_n_s_cls); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_next, 949, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(0, 949, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":954
 *         return cls.__lastbtag
 *     @classmethod
 *     def last(cls):             # <<<<<<<<<<<<<<
 *         return cls.__lastbtag
 * 
 */
  __pyx_tuple__180 = PyTuple_Pack(1, __pyx_n_s_cls); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_last, 954, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) __PYX_ERR(0, 954, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":957
 *         return cls.__lastbtag
 * 
 * def mkCommonHeader(msgid):             # <<<<<<<<<<<<<<
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 */
  __pyx_tuple__182 = PyTuple_Pack(3, __pyx_n_s_msgid, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkCommonHeader, 957, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(0, 957, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":963
 * 
 * 
 * def mkTriggerHeader():             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 */
  __pyx_tuple__184 = PyTuple_Pack(2, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkTriggerHeader, 963, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 963, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":968
 *     return (btag,h)
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:
 */
  __pyx_tuple__186 = PyTuple_Pack(4, __pyx_n_s_tsize, __pyx_n_s_eom, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkDevDepMSGOUTHeader, 968, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 968, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":984
 *     return (btag,h)
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:
 */
  __pyx_tuple__188 = PyTuple_Pack(5, __pyx_n_s_tsize, __pyx_n_s_TermCharEnable, __pyx_n_s_TermChar, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkReqDevDepMSGINHeader, 984, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(0, 984, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1003
 * 
 * 
 * def mkVendorSpecMSGOUTHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */
  __pyx_tuple__190 = PyTuple_Pack(3, __pyx_n_s_tsize, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(0, 1003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkVendorSpecMSGOUTHeader, 1003, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 1003, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1013
 *     return (btag,h)
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */
  __pyx_tuple__192 = PyTuple_Pack(3, __pyx_n_s_tsize, __pyx_n_s_btag, __pyx_n_s_h); if (unlikely(!__pyx_tuple__192)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_mkReqVendorSpecMSGINHeader, 1013, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(0, 1013, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1027
 *     convert return value header to structure
 *     """
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]
 */
  __pyx_tuple__194 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 1027, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(0, 1027, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1038
 * 
 * class DevDep_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 */
  __pyx_tuple__196 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__196)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__196);
  __Pyx_GIVEREF(__pyx_tuple__196);
  __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 1038, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) __PYX_ERR(0, 1038, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1051
 * 
 * class VendorSpec_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 */
  __pyx_tuple__198 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__198)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__198);
  __Pyx_GIVEREF(__pyx_tuple__198);
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 1051, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(0, 1051, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1061
 * #
 * class Interrupt_IN_Data:# Table 6, USB488
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.SBR=None
 *         self.statusBytes=None
 */
  __pyx_tuple__200 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__200)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__200);
  __Pyx_GIVEREF(__pyx_tuple__200);
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_init, 1061, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(0, 1061, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1072
 *             self.statusBytes=bytes[1:]
 * #
 * def test():             # <<<<<<<<<<<<<<
 *     #import usb.core, usb.util,usb.backend,usb.backend.libusb1
 *     #dev=usb.core.find(idVendor=0x0957, idProduct=0x0407)
 */
  __pyx_tuple__202 = PyTuple_Pack(4, __pyx_n_s_usbdevs, __pyx_n_s_usbdev, __pyx_n_s_tmcdev, __pyx_n_s_r); if (unlikely(!__pyx_tuple__202)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__202);
  __Pyx_GIVEREF(__pyx_tuple__202);
  __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_test, 1072, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) __PYX_ERR(0, 1072, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1117
 *         return tmcdev
 * 
 * def DSO6K_test(dev=None):             # <<<<<<<<<<<<<<
 *     import Gnuplot
 *     if not dev:
 */
  __pyx_tuple__204 = PyTuple_Pack(13, __pyx_n_s_dev, __pyx_n_s_Gnuplot, __pyx_n_s_n, __pyx_n_s_d, __pyx_n_s_maker, __pyx_n_s_model, __pyx_n_s_sn, __pyx_n_s_vers, __pyx_n_s_wf, __pyx_n_s_wf2, __pyx_n_s_gp, __pyx_n_s_hl, __pyx_n_s_x0); if (unlikely(!__pyx_tuple__204)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__204);
  __Pyx_GIVEREF(__pyx_tuple__204);
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DSO6K_test, 1117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(0, 1117, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1143
 *     return dev
 * 
 * def DSO6K_test_pylab(dev=None):             # <<<<<<<<<<<<<<
 *     import pylab
 *     if not dev:
 */
  __pyx_tuple__206 = PyTuple_Pack(12, __pyx_n_s_dev, __pyx_n_s_pylab, __pyx_n_s_n, __pyx_n_s_d, __pyx_n_s_maker, __pyx_n_s_model, __pyx_n_s_sn, __pyx_n_s_vers, __pyx_n_s_wf, __pyx_n_s_wf2, __pyx_n_s_hl, __pyx_n_s_x0); if (unlikely(!__pyx_tuple__206)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__206);
  __Pyx_GIVEREF(__pyx_tuple__206);
  __pyx_codeobj__207 = (PyObject*)__Pyx_PyCode_New(1, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__206, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DSO6K_test_pylab, 1143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__207)) __PYX_ERR(0, 1143, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1171
 *     return dev
 * 
 * def DPO4K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */
  __pyx_tuple__208 = PyTuple_Pack(8, __pyx_n_s_pylab, __pyx_n_s_time, __pyx_n_s_dev, __pyx_n_s_s_2, __pyx_n_s_n, __pyx_n_s_wf, __pyx_n_s_e, __pyx_n_s_hl); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__208);
  __Pyx_GIVEREF(__pyx_tuple__208);
  __pyx_codeobj__209 = (PyObject*)__Pyx_PyCode_New(0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DPO4K_test, 1171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(0, 1171, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1193
 *     return dev
 * 
 * def DPO3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */
  __pyx_tuple__210 = PyTuple_Pack(8, __pyx_n_s_pylab, __pyx_n_s_time, __pyx_n_s_dev, __pyx_n_s_s_2, __pyx_n_s_n, __pyx_n_s_wf, __pyx_n_s_e, __pyx_n_s_hl); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);
  __pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_DPO3K_test, 1193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(0, 1193, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1215
 *     return dev
 * 
 * def SL1K_test():             # <<<<<<<<<<<<<<
 *     import pylab
 *     dev=test()
 */
  __pyx_tuple__212 = PyTuple_Pack(7, __pyx_n_s_pylab, __pyx_n_s_dev, __pyx_n_s_res, __pyx_n_s_n, __pyx_n_s_wf, __pyx_n_s_hl, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__212);
  __Pyx_GIVEREF(__pyx_tuple__212);
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_SL1K_test, 1215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(0, 1215, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1243
 *     return dev
 * 
 * def AFG3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     devs=find_tmc_devices() #
 */
  __pyx_tuple__214 = PyTuple_Pack(4, __pyx_n_s_pylab, __pyx_n_s_time, __pyx_n_s_devs, __pyx_n_s_dev); if (unlikely(!__pyx_tuple__214)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__214);
  __Pyx_GIVEREF(__pyx_tuple__214);
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_AFG3K_test, 1243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(0, 1243, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":1253
 *     AFG3K_setup_test(dev)
 * 
 * def AFG3K_setup_test(dev):             # <<<<<<<<<<<<<<
 *     import pylab
 *     #'Set CH1 output parameters
 */
  __pyx_tuple__216 = PyTuple_Pack(6, __pyx_n_s_dev, __pyx_n_s_pylab, __pyx_n_s_n, __pyx_n_s_wf, __pyx_n_s_hl, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__216)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__216);
  __Pyx_GIVEREF(__pyx_tuple__216);
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cPyUSBTMC_pyx, __pyx_n_s_AFG3K_setup_test, 1253, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_1 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_float_0_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_01 = PyFloat_FromDouble(0.01); if (unlikely(!__pyx_float_0_01)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_127_ = PyFloat_FromDouble(127.); if (unlikely(!__pyx_float_127_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_126 = PyInt_FromLong(126); if (unlikely(!__pyx_int_126)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_127 = PyInt_FromLong(127); if (unlikely(!__pyx_int_127)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_129 = PyInt_FromLong(129); if (unlikely(!__pyx_int_129)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_130 = PyInt_FromLong(130); if (unlikely(!__pyx_int_130)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_131 = PyInt_FromLong(131); if (unlikely(!__pyx_int_131)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_160 = PyInt_FromLong(160); if (unlikely(!__pyx_int_160)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_161 = PyInt_FromLong(161); if (unlikely(!__pyx_int_161)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_162 = PyInt_FromLong(162); if (unlikely(!__pyx_int_162)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_254 = PyInt_FromLong(254); if (unlikely(!__pyx_int_254)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1033 = PyInt_FromLong(1033); if (unlikely(!__pyx_int_1033)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1689 = PyInt_FromLong(1689); if (unlikely(!__pyx_int_1689)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2391 = PyInt_FromLong(2391); if (unlikely(!__pyx_int_2391)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3000 = PyInt_FromLong(3000); if (unlikely(!__pyx_int_3000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_65536 = PyInt_FromLong(65536L); if (unlikely(!__pyx_int_65536)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2000020 = PyInt_FromLong(2000020L); if (unlikely(!__pyx_int_2000020)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_20000000 = PyInt_FromLong(20000000L); if (unlikely(!__pyx_int_20000000)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initcPyUSBTMC(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initcPyUSBTMC(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_cPyUSBTMC(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_cPyUSBTMC(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_cPyUSBTMC(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'cPyUSBTMC' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cPyUSBTMC(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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 CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("cPyUSBTMC", __pyx_methods, __pyx_k_PyUSBTMC_python_module_to_handl, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_cPyUSBTMC) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "cPyUSBTMC")) {
      if (unlikely(PyDict_SetItemString(modules, "cPyUSBTMC", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  (void)__Pyx_modinit_type_init_code();
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "cPyUSBTMC.pyx":9
 * contact: noboru.yamamoto_at_kek.jp
 * """
 * import struct,array,time,sys             # <<<<<<<<<<<<<<
 * 
 * # from usbtmc.h
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":14
 * # Size of driver internal IO buffer. Must be multiple of 4 and at least as
 * # large as wMaxPacketSize (which is usually 512 bytes).
 * USBTMC_SIZE_DEFAULT   = 4096             # <<<<<<<<<<<<<<
 * #USBTMC_SIZE_IOBUFFER = 32768*10
 * USBTMC_SIZE_IOBUFFER  = 64*1024
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_SIZE_DEFAULT, __pyx_int_4096) < 0) __PYX_ERR(0, 14, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":16
 * USBTMC_SIZE_DEFAULT   = 4096
 * #USBTMC_SIZE_IOBUFFER = 32768*10
 * USBTMC_SIZE_IOBUFFER  = 64*1024             # <<<<<<<<<<<<<<
 * USBTMC_DEFAULT_TIMEOUT = 3000 #msec
 * USBTMC_MAX_READS_TO_CLEAR_BULK_IN = 100
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_SIZE_IOBUFFER, __pyx_int_65536) < 0) __PYX_ERR(0, 16, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":17
 * #USBTMC_SIZE_IOBUFFER = 32768*10
 * USBTMC_SIZE_IOBUFFER  = 64*1024
 * USBTMC_DEFAULT_TIMEOUT = 3000 #msec             # <<<<<<<<<<<<<<
 * USBTMC_MAX_READS_TO_CLEAR_BULK_IN = 100
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_DEFAULT_TIMEOUT, __pyx_int_3000) < 0) __PYX_ERR(0, 17, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":18
 * USBTMC_SIZE_IOBUFFER  = 64*1024
 * USBTMC_DEFAULT_TIMEOUT = 3000 #msec
 * USBTMC_MAX_READS_TO_CLEAR_BULK_IN = 100             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_MAX_READS_TO_CLEAR_BULK_I, __pyx_int_100) < 0) __PYX_ERR(0, 18, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":22
 * 
 * #import usb
 * import usb.core             # <<<<<<<<<<<<<<
 * usb.core.Device.default_timeout=USBTMC_DEFAULT_TIMEOUT
 * from usb import USBError
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_usb_core, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_usb, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":23
 * #import usb
 * import usb.core
 * usb.core.Device.default_timeout=USBTMC_DEFAULT_TIMEOUT             # <<<<<<<<<<<<<<
 * from usb import USBError
 * #from usb.core import *
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_DEFAULT_TIMEOUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_usb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_core); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Device); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_n_s_default_timeout, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":24
 * import usb.core
 * usb.core.Device.default_timeout=USBTMC_DEFAULT_TIMEOUT
 * from usb import USBError             # <<<<<<<<<<<<<<
 * #from usb.core import *
 * #from usb.util import *
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_USBError);
  __Pyx_GIVEREF(__pyx_n_s_USBError);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_USBError);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_usb, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_USBError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBError, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":27
 * #from usb.core import *
 * #from usb.util import *
 * from usb.util import dispose_resources,build_request_type             # <<<<<<<<<<<<<<
 * from usb.util import CTRL_IN, CTRL_OUT, CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_ENDPOINT, CTRL_RECIPIENT_INTERFACE, CTRL_RECIPIENT_OTHER
 * from usb.util import CTRL_TYPE_CLASS, CTRL_TYPE_RESERVED, CTRL_TYPE_STANDARD, CTRL_TYPE_VENDOR
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_dispose_resources);
  __Pyx_GIVEREF(__pyx_n_s_dispose_resources);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dispose_resources);
  __Pyx_INCREF(__pyx_n_s_build_request_type);
  __Pyx_GIVEREF(__pyx_n_s_build_request_type);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_build_request_type);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_usb_util, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dispose_resources); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dispose_resources, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_build_request_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_build_request_type, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":28
 * #from usb.util import *
 * from usb.util import dispose_resources,build_request_type
 * from usb.util import CTRL_IN, CTRL_OUT, CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_ENDPOINT, CTRL_RECIPIENT_INTERFACE, CTRL_RECIPIENT_OTHER             # <<<<<<<<<<<<<<
 * from usb.util import CTRL_TYPE_CLASS, CTRL_TYPE_RESERVED, CTRL_TYPE_STANDARD, CTRL_TYPE_VENDOR
 * from usb.util import DESC_TYPE_CONFIG, DESC_TYPE_DEVICE, DESC_TYPE_ENDPOINT, DESC_TYPE_INTERFACE, DESC_TYPE_STRING
 */
  __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_CTRL_IN);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_IN);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CTRL_IN);
  __Pyx_INCREF(__pyx_n_s_CTRL_OUT);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_OUT);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_CTRL_OUT);
  __Pyx_INCREF(__pyx_n_s_CTRL_RECIPIENT_DEVICE);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_RECIPIENT_DEVICE);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_CTRL_RECIPIENT_DEVICE);
  __Pyx_INCREF(__pyx_n_s_CTRL_RECIPIENT_ENDPOINT);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_RECIPIENT_ENDPOINT);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT);
  __Pyx_INCREF(__pyx_n_s_CTRL_RECIPIENT_INTERFACE);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_RECIPIENT_INTERFACE);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_CTRL_RECIPIENT_INTERFACE);
  __Pyx_INCREF(__pyx_n_s_CTRL_RECIPIENT_OTHER);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_RECIPIENT_OTHER);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_CTRL_RECIPIENT_OTHER);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_usb_util, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_IN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_IN, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_OUT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_OUT, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_RECIPIENT_DEVICE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_RECIPIENT_DEVICE, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_RECIPIENT_ENDPOINT, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_RECIPIENT_INTERFACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_RECIPIENT_INTERFACE, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CTRL_RECIPIENT_OTHER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_RECIPIENT_OTHER, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":29
 * from usb.util import dispose_resources,build_request_type
 * from usb.util import CTRL_IN, CTRL_OUT, CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_ENDPOINT, CTRL_RECIPIENT_INTERFACE, CTRL_RECIPIENT_OTHER
 * from usb.util import CTRL_TYPE_CLASS, CTRL_TYPE_RESERVED, CTRL_TYPE_STANDARD, CTRL_TYPE_VENDOR             # <<<<<<<<<<<<<<
 * from usb.util import DESC_TYPE_CONFIG, DESC_TYPE_DEVICE, DESC_TYPE_ENDPOINT, DESC_TYPE_INTERFACE, DESC_TYPE_STRING
 * from usb.util import ENDPOINT_IN, ENDPOINT_OUT, ENDPOINT_TYPE_BULK, ENDPOINT_TYPE_CTRL, ENDPOINT_TYPE_INTR, ENDPOINT_TYPE_ISO
 */
  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_CTRL_TYPE_CLASS);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_TYPE_CLASS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_CTRL_TYPE_CLASS);
  __Pyx_INCREF(__pyx_n_s_CTRL_TYPE_RESERVED);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_TYPE_RESERVED);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_CTRL_TYPE_RESERVED);
  __Pyx_INCREF(__pyx_n_s_CTRL_TYPE_STANDARD);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_TYPE_STANDARD);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_CTRL_TYPE_STANDARD);
  __Pyx_INCREF(__pyx_n_s_CTRL_TYPE_VENDOR);
  __Pyx_GIVEREF(__pyx_n_s_CTRL_TYPE_VENDOR);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_CTRL_TYPE_VENDOR);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_usb_util, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CTRL_TYPE_CLASS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_TYPE_CLASS, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CTRL_TYPE_RESERVED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_TYPE_RESERVED, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CTRL_TYPE_STANDARD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_TYPE_STANDARD, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_CTRL_TYPE_VENDOR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTRL_TYPE_VENDOR, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":30
 * from usb.util import CTRL_IN, CTRL_OUT, CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_ENDPOINT, CTRL_RECIPIENT_INTERFACE, CTRL_RECIPIENT_OTHER
 * from usb.util import CTRL_TYPE_CLASS, CTRL_TYPE_RESERVED, CTRL_TYPE_STANDARD, CTRL_TYPE_VENDOR
 * from usb.util import DESC_TYPE_CONFIG, DESC_TYPE_DEVICE, DESC_TYPE_ENDPOINT, DESC_TYPE_INTERFACE, DESC_TYPE_STRING             # <<<<<<<<<<<<<<
 * from usb.util import ENDPOINT_IN, ENDPOINT_OUT, ENDPOINT_TYPE_BULK, ENDPOINT_TYPE_CTRL, ENDPOINT_TYPE_INTR, ENDPOINT_TYPE_ISO
 * import usb.control as usbctrl
 */
  __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_DESC_TYPE_CONFIG);
  __Pyx_GIVEREF(__pyx_n_s_DESC_TYPE_CONFIG);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DESC_TYPE_CONFIG);
  __Pyx_INCREF(__pyx_n_s_DESC_TYPE_DEVICE);
  __Pyx_GIVEREF(__pyx_n_s_DESC_TYPE_DEVICE);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DESC_TYPE_DEVICE);
  __Pyx_INCREF(__pyx_n_s_DESC_TYPE_ENDPOINT);
  __Pyx_GIVEREF(__pyx_n_s_DESC_TYPE_ENDPOINT);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DESC_TYPE_ENDPOINT);
  __Pyx_INCREF(__pyx_n_s_DESC_TYPE_INTERFACE);
  __Pyx_GIVEREF(__pyx_n_s_DESC_TYPE_INTERFACE);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DESC_TYPE_INTERFACE);
  __Pyx_INCREF(__pyx_n_s_DESC_TYPE_STRING);
  __Pyx_GIVEREF(__pyx_n_s_DESC_TYPE_STRING);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_DESC_TYPE_STRING);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_usb_util, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DESC_TYPE_CONFIG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DESC_TYPE_CONFIG, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DESC_TYPE_DEVICE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DESC_TYPE_DEVICE, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DESC_TYPE_ENDPOINT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DESC_TYPE_ENDPOINT, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DESC_TYPE_INTERFACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DESC_TYPE_INTERFACE, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DESC_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DESC_TYPE_STRING, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":31
 * from usb.util import CTRL_TYPE_CLASS, CTRL_TYPE_RESERVED, CTRL_TYPE_STANDARD, CTRL_TYPE_VENDOR
 * from usb.util import DESC_TYPE_CONFIG, DESC_TYPE_DEVICE, DESC_TYPE_ENDPOINT, DESC_TYPE_INTERFACE, DESC_TYPE_STRING
 * from usb.util import ENDPOINT_IN, ENDPOINT_OUT, ENDPOINT_TYPE_BULK, ENDPOINT_TYPE_CTRL, ENDPOINT_TYPE_INTR, ENDPOINT_TYPE_ISO             # <<<<<<<<<<<<<<
 * import usb.control as usbctrl
 * 
 */
  __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_IN);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_IN);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ENDPOINT_IN);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_OUT);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_OUT);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ENDPOINT_OUT);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_TYPE_BULK);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_TYPE_BULK);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_ENDPOINT_TYPE_BULK);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_TYPE_CTRL);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_TYPE_CTRL);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_ENDPOINT_TYPE_CTRL);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_TYPE_INTR);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_TYPE_INTR);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_ENDPOINT_TYPE_INTR);
  __Pyx_INCREF(__pyx_n_s_ENDPOINT_TYPE_ISO);
  __Pyx_GIVEREF(__pyx_n_s_ENDPOINT_TYPE_ISO);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_ENDPOINT_TYPE_ISO);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_usb_util, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_IN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_IN, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_OUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_OUT, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_TYPE_BULK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_TYPE_BULK, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_TYPE_CTRL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_TYPE_CTRL, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_TYPE_INTR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_TYPE_INTR, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ENDPOINT_TYPE_ISO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENDPOINT_TYPE_ISO, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":32
 * from usb.util import DESC_TYPE_CONFIG, DESC_TYPE_DEVICE, DESC_TYPE_ENDPOINT, DESC_TYPE_INTERFACE, DESC_TYPE_STRING
 * from usb.util import ENDPOINT_IN, ENDPOINT_OUT, ENDPOINT_TYPE_BULK, ENDPOINT_TYPE_CTRL, ENDPOINT_TYPE_INTR, ENDPOINT_TYPE_ISO
 * import usb.control as usbctrl             # <<<<<<<<<<<<<<
 * 
 * #from lsusb import show_endpoint
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s__14);
  __Pyx_GIVEREF(__pyx_n_s__14);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__14);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_usb_control, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_usbctrl, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":37
 * 
 * # from  USB-TMC table2
 * class USBTMC_MsgID:             # <<<<<<<<<<<<<<
 *     # 0 : Reserved
 *     DEV_DEP_MSG_OUT        = 1
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_USBTMC_MsgID, __pyx_n_s_USBTMC_MsgID, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":39
 * class USBTMC_MsgID:
 *     # 0 : Reserved
 *     DEV_DEP_MSG_OUT        = 1             # <<<<<<<<<<<<<<
 *     REQUEST_DEV_DEP_MSG_IN = 2
 *     DEV_DEP_MSG_IN         = 2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DEV_DEP_MSG_OUT, __pyx_int_1) < 0) __PYX_ERR(0, 39, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":40
 *     # 0 : Reserved
 *     DEV_DEP_MSG_OUT        = 1
 *     REQUEST_DEV_DEP_MSG_IN = 2             # <<<<<<<<<<<<<<
 *     DEV_DEP_MSG_IN         = 2
 *     #3-125 Reserved for USBTMC use.
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_REQUEST_DEV_DEP_MSG_IN, __pyx_int_2) < 0) __PYX_ERR(0, 40, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":41
 *     DEV_DEP_MSG_OUT        = 1
 *     REQUEST_DEV_DEP_MSG_IN = 2
 *     DEV_DEP_MSG_IN         = 2             # <<<<<<<<<<<<<<
 *     #3-125 Reserved for USBTMC use.
 *     VENDOR_SPECIFIC_OUT    = 126
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DEV_DEP_MSG_IN, __pyx_int_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":43
 *     DEV_DEP_MSG_IN         = 2
 *     #3-125 Reserved for USBTMC use.
 *     VENDOR_SPECIFIC_OUT    = 126             # <<<<<<<<<<<<<<
 *     REQUEST_VENDOR_SPECIFIC_IN = 127
 *     VENDOR_SPECIFIC_IN     = 127
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_VENDOR_SPECIFIC_OUT, __pyx_int_126) < 0) __PYX_ERR(0, 43, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":44
 *     #3-125 Reserved for USBTMC use.
 *     VENDOR_SPECIFIC_OUT    = 126
 *     REQUEST_VENDOR_SPECIFIC_IN = 127             # <<<<<<<<<<<<<<
 *     VENDOR_SPECIFIC_IN     = 127
 *     # 128-191 Reserved for USBTMC subclass use.
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_REQUEST_VENDOR_SPECIFIC_IN, __pyx_int_127) < 0) __PYX_ERR(0, 44, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":45
 *     VENDOR_SPECIFIC_OUT    = 126
 *     REQUEST_VENDOR_SPECIFIC_IN = 127
 *     VENDOR_SPECIFIC_IN     = 127             # <<<<<<<<<<<<<<
 *     # 128-191 Reserved for USBTMC subclass use.
 *     TRIGGER                = 128 # for USB488
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_VENDOR_SPECIFIC_IN, __pyx_int_127) < 0) __PYX_ERR(0, 45, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":47
 *     VENDOR_SPECIFIC_IN     = 127
 *     # 128-191 Reserved for USBTMC subclass use.
 *     TRIGGER                = 128 # for USB488             # <<<<<<<<<<<<<<
 *     # 192-255  Reserved for VISA specification use.
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_TRIGGER, __pyx_int_128) < 0) __PYX_ERR(0, 47, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":37
 * 
 * # from  USB-TMC table2
 * class USBTMC_MsgID:             # <<<<<<<<<<<<<<
 *     # 0 : Reserved
 *     DEV_DEP_MSG_OUT        = 1
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_USBTMC_MsgID, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_MsgID, __pyx_t_2) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":50
 *     # 192-255  Reserved for VISA specification use.
 * 
 * Mandatory_LANGID=0x0409 # English,United State             # <<<<<<<<<<<<<<
 * 
 * #
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Mandatory_LANGID, __pyx_int_1033) < 0) __PYX_ERR(0, 50, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":53
 * 
 * #
 * USBTMC_bInterfaceClass   =254 #0xfe             # <<<<<<<<<<<<<<
 * USBTMC_bInterfaceSubClass=3 # usbtmc
 * USBTMC_bInterfaceProtocol=0
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_bInterfaceClass, __pyx_int_254) < 0) __PYX_ERR(0, 53, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":54
 * #
 * USBTMC_bInterfaceClass   =254 #0xfe
 * USBTMC_bInterfaceSubClass=3 # usbtmc             # <<<<<<<<<<<<<<
 * USBTMC_bInterfaceProtocol=0
 * USB488_bInterfaceSubClass=1
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_bInterfaceSubClass, __pyx_int_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":55
 * USBTMC_bInterfaceClass   =254 #0xfe
 * USBTMC_bInterfaceSubClass=3 # usbtmc
 * USBTMC_bInterfaceProtocol=0             # <<<<<<<<<<<<<<
 * USB488_bInterfaceSubClass=1
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_bInterfaceProtocol, __pyx_int_0) < 0) __PYX_ERR(0, 55, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":56
 * USBTMC_bInterfaceSubClass=3 # usbtmc
 * USBTMC_bInterfaceProtocol=0
 * USB488_bInterfaceSubClass=1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USB488_bInterfaceSubClass, __pyx_int_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":70
 * # it means 'use "<" in pack/unpack of struct module.'
 * 
 * def find_tmc_devices():             # <<<<<<<<<<<<<<
 *     """
 *     get the list of USB devices which belongs USBTMC Class.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_1find_tmc_devices, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_tmc_devices, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":90
 * 
 * # Table11 Bulk-IN protocol error
 * class USBTMCError(USBError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_USBTMCError, __pyx_n_s_USBTMCError, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_USBTMCError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMCError, __pyx_t_4) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":93
 *     pass
 * 
 * class USBTMC_BulkInError(USBTMCError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_USBTMCError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_USBTMC_BulkInError, __pyx_n_s_USBTMC_BulkInError, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_USBTMC_BulkInError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_BulkInError, __pyx_t_4) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":97
 * 
 * #
 * class usbtmc_dev_capabilities:             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         self.interface_capabilities=""
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_usbtmc_dev_capabilities, __pyx_n_s_usbtmc_dev_capabilities, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":98
 * #
 * class usbtmc_dev_capabilities:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.interface_capabilities=""
 *         self.device_capabilities=""
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_23usbtmc_dev_capabilities_1__init__, 0, __pyx_n_s_usbtmc_dev_capabilities___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":97
 * 
 * #
 * class usbtmc_dev_capabilities:             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         self.interface_capabilities=""
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_usbtmc_dev_capabilities, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_usbtmc_dev_capabilities, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":104
 *         self.usb488_device_capabilities=""
 * 
 * class usbtmc_attribute:             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         self.attribute=0
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_usbtmc_attribute, __pyx_n_s_usbtmc_attribute, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":105
 * 
 * class usbtmc_attribute:
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.attribute=0
 *         self.value=0
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_16usbtmc_attribute_1__init__, 0, __pyx_n_s_usbtmc_attribute___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":104
 *         self.usb488_device_capabilities=""
 * 
 * class usbtmc_attribute:             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         self.attribute=0
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_usbtmc_attribute, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_usbtmc_attribute, __pyx_t_2) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":110
 * 
 * # USBTMC status values/USBTMC Table 16
 * class USBTMC_Status:             # <<<<<<<<<<<<<<
 *     SUCCESS = 0x01
 *     PENDING = 0x02
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_USBTMC_Status, __pyx_n_s_USBTMC_Status, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":111
 * # USBTMC status values/USBTMC Table 16
 * class USBTMC_Status:
 *     SUCCESS = 0x01             # <<<<<<<<<<<<<<
 *     PENDING = 0x02
 *     FAILED  = 0x80
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_SUCCESS, __pyx_int_1) < 0) __PYX_ERR(0, 111, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":112
 * class USBTMC_Status:
 *     SUCCESS = 0x01
 *     PENDING = 0x02             # <<<<<<<<<<<<<<
 *     FAILED  = 0x80
 *     TRANSFER_NOT_IN_PROGRESS = 0x81
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_PENDING, __pyx_int_2) < 0) __PYX_ERR(0, 112, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":113
 *     SUCCESS = 0x01
 *     PENDING = 0x02
 *     FAILED  = 0x80             # <<<<<<<<<<<<<<
 *     TRANSFER_NOT_IN_PROGRESS = 0x81
 *     SPLIT_NOT_IN_PROGRESS    = 0x82
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_FAILED, __pyx_int_128) < 0) __PYX_ERR(0, 113, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":114
 *     PENDING = 0x02
 *     FAILED  = 0x80
 *     TRANSFER_NOT_IN_PROGRESS = 0x81             # <<<<<<<<<<<<<<
 *     SPLIT_NOT_IN_PROGRESS    = 0x82
 *     SPLIT_IN_PROGRESS        = 0x83
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_TRANSFER_NOT_IN_PROGRESS, __pyx_int_129) < 0) __PYX_ERR(0, 114, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":115
 *     FAILED  = 0x80
 *     TRANSFER_NOT_IN_PROGRESS = 0x81
 *     SPLIT_NOT_IN_PROGRESS    = 0x82             # <<<<<<<<<<<<<<
 *     SPLIT_IN_PROGRESS        = 0x83
 *     # only fo USB488
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_SPLIT_NOT_IN_PROGRESS, __pyx_int_130) < 0) __PYX_ERR(0, 115, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":116
 *     TRANSFER_NOT_IN_PROGRESS = 0x81
 *     SPLIT_NOT_IN_PROGRESS    = 0x82
 *     SPLIT_IN_PROGRESS        = 0x83             # <<<<<<<<<<<<<<
 *     # only fo USB488
 *     INTERRUPT_IN_BUSY       = 0x20
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_SPLIT_IN_PROGRESS, __pyx_int_131) < 0) __PYX_ERR(0, 116, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":118
 *     SPLIT_IN_PROGRESS        = 0x83
 *     # only fo USB488
 *     INTERRUPT_IN_BUSY       = 0x20             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_INTERRUPT_IN_BUSY, __pyx_int_32) < 0) __PYX_ERR(0, 118, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":121
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.SUCCESS):
 *             return "Success"
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_Status_1msg, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_USBTMC_Status_msg, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":120
 *     INTERRUPT_IN_BUSY       = 0x20
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def msg(cls,i):
 *         if (i == cls.SUCCESS):
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_msg, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":110
 * 
 * # USBTMC status values/USBTMC Table 16
 * class USBTMC_Status:             # <<<<<<<<<<<<<<
 *     SUCCESS = 0x01
 *     PENDING = 0x02
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_USBTMC_Status, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_Status, __pyx_t_3) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":136
 *         return "Reserved"
 * #
 * class IEEE488_Status_Byte_Reg:             # <<<<<<<<<<<<<<
 *     def __init__(self,byte):
 *         self.raw    = byte
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_IEEE488_Status_Byte_Reg, __pyx_n_s_IEEE488_Status_Byte_Reg, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":137
 * #
 * class IEEE488_Status_Byte_Reg:
 *     def __init__(self,byte):             # <<<<<<<<<<<<<<
 *         self.raw    = byte
 *         self.OPER   =(byte & 0x80)>>7
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_23IEEE488_Status_Byte_Reg_1__init__, 0, __pyx_n_s_IEEE488_Status_Byte_Reg___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":136
 *         return "Reserved"
 * #
 * class IEEE488_Status_Byte_Reg:             # <<<<<<<<<<<<<<
 *     def __init__(self,byte):
 *         self.raw    = byte
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_IEEE488_Status_Byte_Reg, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IEEE488_Status_Byte_Reg, __pyx_t_3) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":147
 *         self.TRG    =(byte & 0x01)>>0
 * 
 * class USB488_Status(USBTMC_Status):             # <<<<<<<<<<<<<<
 *     INTERRUPT_IN_BUSY=0x20
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_Status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_USB488_Status, __pyx_n_s_USB488_Status, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":148
 * 
 * class USB488_Status(USBTMC_Status):
 *     INTERRUPT_IN_BUSY=0x20             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, bytes):
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_INTERRUPT_IN_BUSY, __pyx_int_32) < 0) __PYX_ERR(0, 148, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":150
 *     INTERRUPT_IN_BUSY=0x20
 * 
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.USBTMC_status=bytes[0]
 *         self.bTag=bytes[1]
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_Status_1__init__, 0, __pyx_n_s_USB488_Status___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cPyUSBTMC.pyx":156
 * 
 *     @classmethod
 *     def msg(cls,i):             # <<<<<<<<<<<<<<
 *         if (i == cls.INTERRUPT_IN_BUSY):
 *             return "Interrupt in busy"
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_Status_3msg, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_USB488_Status_msg, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cPyUSBTMC.pyx":155
 *         self.SBR=IEEE488_Status_Byte_Reg(bytes[2])
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def msg(cls,i):
 *         if (i == cls.INTERRUPT_IN_BUSY):
 */
  __pyx_t_5 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_msg, __pyx_t_5) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":147
 *         self.TRG    =(byte & 0x01)>>0
 * 
 * class USB488_Status(USBTMC_Status):             # <<<<<<<<<<<<<<
 *     INTERRUPT_IN_BUSY=0x20
 * 
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_USB488_Status, __pyx_t_3, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USB488_Status, __pyx_t_5) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":163
 * 
 * #USBTMC requests values/USBTMC Table 15
 * class USBTMC_REQUEST:             # <<<<<<<<<<<<<<
 *     INITIATE_ABORT_BULK_OUT     = 1
 *     CHECK_ABORT_BULK_OUT_STATUS = 2
 */
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_USBTMC_REQUEST, __pyx_n_s_USBTMC_REQUEST, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":164
 * #USBTMC requests values/USBTMC Table 15
 * class USBTMC_REQUEST:
 *     INITIATE_ABORT_BULK_OUT     = 1             # <<<<<<<<<<<<<<
 *     CHECK_ABORT_BULK_OUT_STATUS = 2
 *     INITIATE_ABORT_BULK_IN      = 3
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_INITIATE_ABORT_BULK_OUT, __pyx_int_1) < 0) __PYX_ERR(0, 164, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":165
 * class USBTMC_REQUEST:
 *     INITIATE_ABORT_BULK_OUT     = 1
 *     CHECK_ABORT_BULK_OUT_STATUS = 2             # <<<<<<<<<<<<<<
 *     INITIATE_ABORT_BULK_IN      = 3
 *     CHECK_ABORT_BULK_IN_STATUS  = 4
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CHECK_ABORT_BULK_OUT_STATUS, __pyx_int_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":166
 *     INITIATE_ABORT_BULK_OUT     = 1
 *     CHECK_ABORT_BULK_OUT_STATUS = 2
 *     INITIATE_ABORT_BULK_IN      = 3             # <<<<<<<<<<<<<<
 *     CHECK_ABORT_BULK_IN_STATUS  = 4
 *     INITIATE_CLEAR              = 5
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_INITIATE_ABORT_BULK_IN, __pyx_int_3) < 0) __PYX_ERR(0, 166, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":167
 *     CHECK_ABORT_BULK_OUT_STATUS = 2
 *     INITIATE_ABORT_BULK_IN      = 3
 *     CHECK_ABORT_BULK_IN_STATUS  = 4             # <<<<<<<<<<<<<<
 *     INITIATE_CLEAR              = 5
 *     CHECK_CLEAR_STATUS          = 6
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CHECK_ABORT_BULK_IN_STATUS, __pyx_int_4) < 0) __PYX_ERR(0, 167, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":168
 *     INITIATE_ABORT_BULK_IN      = 3
 *     CHECK_ABORT_BULK_IN_STATUS  = 4
 *     INITIATE_CLEAR              = 5             # <<<<<<<<<<<<<<
 *     CHECK_CLEAR_STATUS          = 6
 *     GET_CAPABILITIES            = 7
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_INITIATE_CLEAR, __pyx_int_5) < 0) __PYX_ERR(0, 168, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":169
 *     CHECK_ABORT_BULK_IN_STATUS  = 4
 *     INITIATE_CLEAR              = 5
 *     CHECK_CLEAR_STATUS          = 6             # <<<<<<<<<<<<<<
 *     GET_CAPABILITIES            = 7
 *     INDICATOR_PULSE             = 64
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CHECK_CLEAR_STATUS, __pyx_int_6) < 0) __PYX_ERR(0, 169, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":170
 *     INITIATE_CLEAR              = 5
 *     CHECK_CLEAR_STATUS          = 6
 *     GET_CAPABILITIES            = 7             # <<<<<<<<<<<<<<
 *     INDICATOR_PULSE             = 64
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_GET_CAPABILITIES, __pyx_int_7) < 0) __PYX_ERR(0, 170, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":171
 *     CHECK_CLEAR_STATUS          = 6
 *     GET_CAPABILITIES            = 7
 *     INDICATOR_PULSE             = 64             # <<<<<<<<<<<<<<
 * 
 * class USB488_REQUEST(USBTMC_REQUEST):# USB488 Table 9
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_INDICATOR_PULSE, __pyx_int_64) < 0) __PYX_ERR(0, 171, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":163
 * 
 * #USBTMC requests values/USBTMC Table 15
 * class USBTMC_REQUEST:             # <<<<<<<<<<<<<<
 *     INITIATE_ABORT_BULK_OUT     = 1
 *     CHECK_ABORT_BULK_OUT_STATUS = 2
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_USBTMC_REQUEST, __pyx_empty_tuple, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_REQUEST, __pyx_t_1) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":173
 *     INDICATOR_PULSE             = 64
 * 
 * class USB488_REQUEST(USBTMC_REQUEST):# USB488 Table 9             # <<<<<<<<<<<<<<
 *     READ_STATUS_BYTE = 128
 *     REN_CONTROL      = 160
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_REQUEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_USB488_REQUEST, __pyx_n_s_USB488_REQUEST, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":174
 * 
 * class USB488_REQUEST(USBTMC_REQUEST):# USB488 Table 9
 *     READ_STATUS_BYTE = 128             # <<<<<<<<<<<<<<
 *     REN_CONTROL      = 160
 *     GOTO_LOCAL       = 161
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_READ_STATUS_BYTE, __pyx_int_128) < 0) __PYX_ERR(0, 174, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":175
 * class USB488_REQUEST(USBTMC_REQUEST):# USB488 Table 9
 *     READ_STATUS_BYTE = 128
 *     REN_CONTROL      = 160             # <<<<<<<<<<<<<<
 *     GOTO_LOCAL       = 161
 *     LOCAL_LOCKOUT    = 162
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_REN_CONTROL, __pyx_int_160) < 0) __PYX_ERR(0, 175, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":176
 *     READ_STATUS_BYTE = 128
 *     REN_CONTROL      = 160
 *     GOTO_LOCAL       = 161             # <<<<<<<<<<<<<<
 *     LOCAL_LOCKOUT    = 162
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_GOTO_LOCAL, __pyx_int_161) < 0) __PYX_ERR(0, 176, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":177
 *     REN_CONTROL      = 160
 *     GOTO_LOCAL       = 161
 *     LOCAL_LOCKOUT    = 162             # <<<<<<<<<<<<<<
 * 
 * class StandardFeature:# usb2.0 table 9-6
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_LOCAL_LOCKOUT, __pyx_int_162) < 0) __PYX_ERR(0, 177, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":173
 *     INDICATOR_PULSE             = 64
 * 
 * class USB488_REQUEST(USBTMC_REQUEST):# USB488 Table 9             # <<<<<<<<<<<<<<
 *     READ_STATUS_BYTE = 128
 *     REN_CONTROL      = 160
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_USB488_REQUEST, __pyx_t_1, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USB488_REQUEST, __pyx_t_5) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":179
 *     LOCAL_LOCKOUT    = 162
 * 
 * class StandardFeature:# usb2.0 table 9-6             # <<<<<<<<<<<<<<
 *     DEVICE_REMOTE_WAKEUP = 1
 *     ENDPOINT_HALT = 0
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_StandardFeature, __pyx_n_s_StandardFeature, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":180
 * 
 * class StandardFeature:# usb2.0 table 9-6
 *     DEVICE_REMOTE_WAKEUP = 1             # <<<<<<<<<<<<<<
 *     ENDPOINT_HALT = 0
 *     TEST_MODE = 2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DEVICE_REMOTE_WAKEUP, __pyx_int_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":181
 * class StandardFeature:# usb2.0 table 9-6
 *     DEVICE_REMOTE_WAKEUP = 1
 *     ENDPOINT_HALT = 0             # <<<<<<<<<<<<<<
 *     TEST_MODE = 2
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ENDPOINT_HALT, __pyx_int_0) < 0) __PYX_ERR(0, 181, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":182
 *     DEVICE_REMOTE_WAKEUP = 1
 *     ENDPOINT_HALT = 0
 *     TEST_MODE = 2             # <<<<<<<<<<<<<<
 * 
 * class SREmask:
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_TEST_MODE, __pyx_int_2) < 0) __PYX_ERR(0, 182, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":179
 *     LOCAL_LOCKOUT    = 162
 * 
 * class StandardFeature:# usb2.0 table 9-6             # <<<<<<<<<<<<<<
 *     DEVICE_REMOTE_WAKEUP = 1
 *     ENDPOINT_HALT = 0
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_StandardFeature, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_StandardFeature, __pyx_t_3) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":184
 *     TEST_MODE = 2
 * 
 * class SREmask:             # <<<<<<<<<<<<<<
 *     OPER = 1<<7
 *     ESB  = 1<<5
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_SREmask, __pyx_n_s_SREmask, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":185
 * 
 * class SREmask:
 *     OPER = 1<<7             # <<<<<<<<<<<<<<
 *     ESB  = 1<<5
 *     MAV  = 1<<4
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_OPER, __pyx_int_128) < 0) __PYX_ERR(0, 185, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":186
 * class SREmask:
 *     OPER = 1<<7
 *     ESB  = 1<<5             # <<<<<<<<<<<<<<
 *     MAV  = 1<<4
 *     MSG  = 1<<2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ESB, __pyx_int_32) < 0) __PYX_ERR(0, 186, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":187
 *     OPER = 1<<7
 *     ESB  = 1<<5
 *     MAV  = 1<<4             # <<<<<<<<<<<<<<
 *     MSG  = 1<<2
 *     USR  = 1<<1
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_MAV, __pyx_int_16) < 0) __PYX_ERR(0, 187, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":188
 *     ESB  = 1<<5
 *     MAV  = 1<<4
 *     MSG  = 1<<2             # <<<<<<<<<<<<<<
 *     USR  = 1<<1
 *     TRG  = 1<<0
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_MSG, __pyx_int_4) < 0) __PYX_ERR(0, 188, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":189
 *     MAV  = 1<<4
 *     MSG  = 1<<2
 *     USR  = 1<<1             # <<<<<<<<<<<<<<
 *     TRG  = 1<<0
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_USR, __pyx_int_2) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":190
 *     MSG  = 1<<2
 *     USR  = 1<<1
 *     TRG  = 1<<0             # <<<<<<<<<<<<<<
 * 
 * class USBTMC_device:
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_TRG, __pyx_int_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":184
 *     TEST_MODE = 2
 * 
 * class SREmask:             # <<<<<<<<<<<<<<
 *     OPER = 1<<7
 *     ESB  = 1<<5
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_SREmask, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SREmask, __pyx_t_3) < 0) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":192
 *     TRG  = 1<<0
 * 
 * class USBTMC_device:             # <<<<<<<<<<<<<<
 *     #
 *     @classmethod
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_USBTMC_device, __pyx_n_s_USBTMC_device, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":195
 *     #
 *     @classmethod
 *     def find_all(cls):             # <<<<<<<<<<<<<<
 *         usbdevs=find_tmc_devices()
 *         return [cls(dev) for dev in usbdevs]
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_1find_all, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_USBTMC_device_find_all, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":194
 * class USBTMC_device:
 *     #
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def find_all(cls):
 *         usbdevs=find_tmc_devices()
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_find_all, __pyx_t_2) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":199
 *         return [cls(dev) for dev in usbdevs]
 * 
 *     def __init__(self,device):             # <<<<<<<<<<<<<<
 *         # device:usb.core.Device
 *         self.device=device
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_3__init__, 0, __pyx_n_s_USBTMC_device___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":224
 *         raise USBError("the device is not USBTMC/USB488 Class device")
 * 
 *     def __init_data__(self):             # <<<<<<<<<<<<<<
 *         self.last_write_bTag=0
 *         self.last_read_bTag=0
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_5__init_data__, 0, __pyx_n_s_USBTMC_device___init_data, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init_data, __pyx_t_2) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":233
 *         self.term_char="\n"
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         # # you may not need all three of them here. But should not cause any problem anyway.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_7__del__, 0, __pyx_n_s_USBTMC_device___del, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_del, __pyx_t_2) < 0) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":257
 *         return
 * 
 *     def getendpoints(self, cnf, intf):             # <<<<<<<<<<<<<<
 *         self.intf = intf
 *         #intf.set_altsetting()
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_9getendpoints, 0, __pyx_n_s_USBTMC_device_getendpoints, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_getendpoints, __pyx_t_2) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":290
 * 
 * 
 *     def isUSB488(self):             # <<<<<<<<<<<<<<
 *         if (self.intf.bInterfaceProtocol == 1):
 *             return True
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_11isUSB488, 0, __pyx_n_s_USBTMC_device_isUSB488, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_isUSB488, __pyx_t_2) < 0) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":296
 *             return False
 * 
 *     def usb_get_status(self,recipient=None):             # <<<<<<<<<<<<<<
 *         """
 *         recipient can be None(default) or Interfae or endpoint.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_13usb_get_status, 0, __pyx_n_s_USBTMC_device_usb_get_status, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__43);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_usb_get_status, __pyx_t_2) < 0) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":306
 *         return  usb.control.get_status(self.device, recipient)
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         return self.device.reset()
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_15reset, 0, __pyx_n_s_USBTMC_device_reset, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_reset, __pyx_t_2) < 0) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":309
 *         return self.device.reset()
 * 
 *     def clear_halt(self):             # <<<<<<<<<<<<<<
 *         """
 *         re-establish synchronization in all end-points.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_17clear_halt, 0, __pyx_n_s_USBTMC_device_clear_halt, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_clear_halt, __pyx_t_2) < 0) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":318
 *             self.intr_in.clear_halt()
 * 
 *     def ask0(self, cmd = "*IDN?\n", requestSize = 0,             # <<<<<<<<<<<<<<
 *              termChar = "\n", termCharFlag = True, io_timeout = 1000):
 *         """
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_19ask0, 0, __pyx_n_s_USBTMC_device_ask0, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__50);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ask0, __pyx_t_2) < 0) __PYX_ERR(0, 318, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":330
 *                           , requestSize = requestSize)
 * 
 *     def ask(self, cmd="*IDN?\n",             # <<<<<<<<<<<<<<
 *             requestSize=0,
 *             termChar="\n",
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_21ask, 0, __pyx_n_s_USBTMC_device_ask, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__53);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ask, __pyx_t_2) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":348
 *         return data
 * 
 *     askS=ask             # <<<<<<<<<<<<<<
 * 
 *     def read(self,requestSize=0, io_timeout=1000
 */
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_ask);
  if (unlikely(!__pyx_t_2)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ask);
  }
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_askS, __pyx_t_2) < 0) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":350
 *     askS=ask
 * 
 *     def read(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *              , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_23read, 0, __pyx_n_s_USBTMC_device_read, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__56);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_read, __pyx_t_2) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":377
 *         return data.tostring()
 *     # for compatibility
 *     readS=read             # <<<<<<<<<<<<<<
 * 
 *     def read0(self,requestSize=0, io_timeout=1000
 */
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_read);
  if (unlikely(!__pyx_t_2)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read);
  }
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_readS, __pyx_t_2) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":379
 *     readS=read
 * 
 *     def read0(self,requestSize=0, io_timeout=1000             # <<<<<<<<<<<<<<
 *               , lock_timeout=0, flag=False, termChar='\x00'):
 *         """
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_25read0, 0, __pyx_n_s_USBTMC_device_read0, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__59);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_read0, __pyx_t_2) < 0) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":402
 *         return (ndata,data)
 * 
 *     def write(self, cmd="*IDN?\n"):             # <<<<<<<<<<<<<<
 *         return self.device_write(cmd)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_27write, 0, __pyx_n_s_USBTMC_device_write, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__62);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_write, __pyx_t_2) < 0) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":405
 *         return self.device_write(cmd)
 * 
 *     def device_write(self,  message):             # <<<<<<<<<<<<<<
 *         remaining=len(message)
 *         while (remaining > 0):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_29device_write, 0, __pyx_n_s_USBTMC_device_device_write, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_device_write, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":434
 *         return
 * 
 *     def device_read(self, transferSize=USBTMC_SIZE_DEFAULT,             # <<<<<<<<<<<<<<
 *                     termCharFlag=False,
 *                     termchar="\0", timeout=1000):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_31device_read, 0, __pyx_n_s_USBTMC_device_device_read, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_USBTMC_SIZE_DEFAULT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_transferSize = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_9cPyUSBTMC_30__defaults__);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_device_read, __pyx_t_2) < 0) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":460
 *         return resp
 * 
 *     def vender_write(self,message):             # <<<<<<<<<<<<<<
 *         """
 *         Vender specific bulk write method. Should be
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_33vender_write, 0, __pyx_n_s_USBTMC_device_vender_write, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_vender_write, __pyx_t_2) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":466
 *         raise USBTMCError("Not Implemented")
 * 
 *     def vender_read(self,maxsize=None):             # <<<<<<<<<<<<<<
 *         raise USBTMCError("Not Implemented")
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_35vender_read, 0, __pyx_n_s_USBTMC_device_vender_read, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__71);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_vender_read, __pyx_t_2) < 0) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":469
 *         raise USBTMCError("Not Implemented")
 * 
 *     def check_SRQ(self):             # <<<<<<<<<<<<<<
 *         rv=self.intr_in.read(self.intr_in.wMaxPacketSize, timeout=self.intr_in.bInterval)
 *         sb=Interrupt_IN_Data(rv)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_37check_SRQ, 0, __pyx_n_s_USBTMC_device_check_SRQ, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_check_SRQ, __pyx_t_2) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":498
 *     value is the data payload read, as an array object."""
 * 
 *     def abort_bulk_out(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             usb.util.build_request_type(# bmRequest type
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_39abort_bulk_out, 0, __pyx_n_s_USBTMC_device_abort_bulk_out, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_abort_bulk_out, __pyx_t_2) < 0) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":522
 *             raise USBTMCError("Initiate abort_bulk_out failed")
 * 
 *     def check_abort_bulk_out_status(self):             # <<<<<<<<<<<<<<
 *         # usb.control.get_status(self.device, self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_41check_abort_bulk_out_status, 0, __pyx_n_s_USBTMC_device_check_abort_bulk_o, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_check_abort_bulk_out_status, __pyx_t_2) < 0) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":533
 *         return rv
 * 
 *     def clear_bulk_out_halt(self):#USBTMC 3.2.2.4             # <<<<<<<<<<<<<<
 *         #usb.control.clear_feature(self.device,usb.ENDPOINT_HALT,self.bulk_out.bEndpointAddress)
 *         rv=self.device.ctrl_transfer(
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_43clear_bulk_out_halt, 0, __pyx_n_s_USBTMC_device_clear_bulk_out_hal, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_clear_bulk_out_halt, __pyx_t_2) < 0) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":547
 *         return rv
 * 
 *     def abort_bulk_in(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(# bmRequest type
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_45abort_bulk_in, 0, __pyx_n_s_USBTMC_device_abort_bulk_in, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_abort_bulk_in, __pyx_t_2) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":569
 *             raise USBTMCError("Initiate abort_bulk_in failed %d"%rv[0])
 * 
 *     def check_abort_bulk_in_status(self):             # <<<<<<<<<<<<<<
 *         n=0
 *         max_size=self.bulk_in.wMaxPacketSize
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_47check_abort_bulk_in_status, 0, __pyx_n_s_USBTMC_device_check_abort_bulk_i, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_check_abort_bulk_in_status, __pyx_t_2) < 0) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":592
 *         return rv
 * 
 *     def clear_bulk_in_halt(self):#USBTMC 3.3.2.4/4.1.1.2             # <<<<<<<<<<<<<<
 *         # rv=usb.control.clear_feature(self.device, usb.control.ENDPOINT_HALT,
 *         #                              self.bulk_in.bEndpointAddress)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_49clear_bulk_in_halt, 0, __pyx_n_s_USBTMC_device_clear_bulk_in_halt, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_clear_bulk_in_halt, __pyx_t_2) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":606
 * 
 *     #
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             bmRequestType=build_request_type(
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_51clear, 0, __pyx_n_s_USBTMC_device_clear, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":629
 *         return rv
 * 
 *     def check_clear_status(self):             # <<<<<<<<<<<<<<
 *         rv=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_53check_clear_status, 0, __pyx_n_s_USBTMC_device_check_clear_status, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_check_clear_status, __pyx_t_2) < 0) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":640
 *         return rv
 * 
 *     def get_capabilities(self):             # <<<<<<<<<<<<<<
 *         # see Table 36 - Get_Capabilities setup packet
 *         b=self.device.ctrl_transfer(
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_55get_capabilities, 0, __pyx_n_s_USBTMC_device_get_capabilities, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_capabilities, __pyx_t_2) < 0) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":654
 *         return None
 * 
 *     def indicator_pulse(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.indicator_pulse:
 *             # see Table 38- Indicator_pulse setup packet
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USBTMC_device_57indicator_pulse, 0, __pyx_n_s_USBTMC_device_indicator_pulse, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_indicator_pulse, __pyx_t_2) < 0) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":192
 *     TRG  = 1<<0
 * 
 * class USBTMC_device:             # <<<<<<<<<<<<<<
 *     #
 *     @classmethod
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_USBTMC_device, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_device, __pyx_t_2) < 0) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":666
 *             raise USBError("INDICATOR_PULSE is not supported on this device")
 * 
 * class USB488_device(USBTMC_device):             # <<<<<<<<<<<<<<
 *     #mandatory commands
 *     def CLS(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_USBTMC_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_USB488_device, __pyx_n_s_USB488_device, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":668
 * class USB488_device(USBTMC_device):
 *     #mandatory commands
 *     def CLS(self):             # <<<<<<<<<<<<<<
 *         self.write("*CLS\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_1CLS, 0, __pyx_n_s_USB488_device_CLS, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CLS_2, __pyx_t_5) < 0) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":671
 *         self.write("*CLS\n")
 * 
 *     def ESE(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*ESE?;\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_3ESE, 0, __pyx_n_s_USB488_device_ESE, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__98);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ESE_3, __pyx_t_5) < 0) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":677
 *             self.write("*ESE;\n")
 * 
 *     def ESR(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*ESQ?;\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_5ESR, 0, __pyx_n_s_USB488_device_ESR, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ESR, __pyx_t_5) < 0) __PYX_ERR(0, 677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":680
 *         return self.ask("*ESQ?;\n")
 * 
 *     def IDN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*IDN?;\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_7IDN, 0, __pyx_n_s_USB488_device_IDN, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_IDN_4, __pyx_t_5) < 0) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":683
 *         return self.ask("*IDN?;\n")
 * 
 *     def OPC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*OPC?;\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_9OPC, 0, __pyx_n_s_USB488_device_OPC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__105);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_OPC_3, __pyx_t_5) < 0) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":689
 *             self.write("*OPC;\n")
 * 
 *     def RST(self):             # <<<<<<<<<<<<<<
 *         self.write("*RST;\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_11RST, 0, __pyx_n_s_USB488_device_RST, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RST_3, __pyx_t_5) < 0) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":692
 *         self.write("*RST;\n")
 * 
 *     def SRE(self,mask=None):             # <<<<<<<<<<<<<<
 *         if mask == None:
 *             return self.ask("*SRE?;\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_13SRE, 0, __pyx_n_s_USB488_device_SRE, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__110);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SRE_2, __pyx_t_5) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":698
 *             self.write("*SRE %d;\n"%mask)
 * 
 *     def STB(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*STB?;\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_15STB, 0, __pyx_n_s_USB488_device_STB, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__112)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_STB_2, __pyx_t_5) < 0) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":701
 *         return self.ask("*STB?;\n")
 * 
 *     def TRG(self):             # <<<<<<<<<<<<<<
 *         self.write("*TRG\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_17TRG, 0, __pyx_n_s_USB488_device_TRG, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TRG, __pyx_t_5) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":704
 *         self.write("*TRG\n")
 * 
 *     def TST(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TST?\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_19TST, 0, __pyx_n_s_USB488_device_TST, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TST_2, __pyx_t_5) < 0) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":707
 *         return self.ask("*TST?\n")
 * 
 *     def WAI(self):             # <<<<<<<<<<<<<<
 *         self.write("*WAI\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_21WAI, 0, __pyx_n_s_USB488_device_WAI, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_WAI_2, __pyx_t_5) < 0) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":712
 *     # optional commands
 * 
 *     def CAL(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_23CAL, 0, __pyx_n_s_USB488_device_CAL, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__120)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CAL_2, __pyx_t_5) < 0) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":717
 *         return self.ask("*CAL?\n")
 * 
 *     def DDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*DDT?\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_25DDT, 0, __pyx_n_s_USB488_device_DDT, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__123);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_DDT_3, __pyx_t_5) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":723
 *             self.write("*DDT\n")
 * 
 *     def DMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*DMC\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_27DMC, 0, __pyx_n_s_USB488_device_DMC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_DMC_2, __pyx_t_5) < 0) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":726
 *         self.write("*DMC\n")
 * 
 *     def EMC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*EMC?\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_29EMC, 0, __pyx_n_s_USB488_device_EMC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__128);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_EMC_3, __pyx_t_5) < 0) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":731
 *         else:
 *             self.write("*EMC\n")
 *     def GMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*GMC?\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_31GMC, 0, __pyx_n_s_USB488_device_GMC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_GMC_2, __pyx_t_5) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":734
 *         return self.ask("*GMC?\n")
 * 
 *     def LMC(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LMC?\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_33LMC, 0, __pyx_n_s_USB488_device_LMC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_LMC_2, __pyx_t_5) < 0) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":737
 *         return self.ask("*LMC?\n")
 * 
 *     def LRN(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*LRN?\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_35LRN, 0, __pyx_n_s_USB488_device_LRN, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_LRN_2, __pyx_t_5) < 0) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":740
 *         return self.ask("*LRN?\n")
 * 
 *     def PSC(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*PSC?\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_37PSC, 0, __pyx_n_s_USB488_device_PSC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__136)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__137);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_PSC_3, __pyx_t_5) < 0) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":746
 *             self.write("*PSC\n")
 * 
 *     def PUD(self):             # <<<<<<<<<<<<<<
 *         self.write("*PUD\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_39PUD, 0, __pyx_n_s_USB488_device_PUD, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_PUD_2, __pyx_t_5) < 0) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":749
 *         self.write("*PUD\n")
 * 
 *     def RCL(self):             # <<<<<<<<<<<<<<
 *         self.write("*RCL\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_41RCL, 0, __pyx_n_s_USB488_device_RCL, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RCL_2, __pyx_t_5) < 0) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":752
 *         self.write("*RCL\n")
 * 
 *     def RDT(self,query=False):             # <<<<<<<<<<<<<<
 *         if query:
 *             return self.ask("*RDT?\n")
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_43RDT, 0, __pyx_n_s_USB488_device_RDT, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__144);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RDT_3, __pyx_t_5) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":758
 *             self.write("*RDT")
 * 
 *     def RMC(self):             # <<<<<<<<<<<<<<
 *         self.write("*RMC\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_45RMC, 0, __pyx_n_s_USB488_device_RMC, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RMC_2, __pyx_t_5) < 0) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":761
 *         self.write("*RMC\n")
 * 
 *     def SAV(self):             # <<<<<<<<<<<<<<
 *         self.write("*SAV\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_47SAV, 0, __pyx_n_s_USB488_device_SAV, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SAV_2, __pyx_t_5) < 0) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":764
 *         self.write("*SAV\n")
 * 
 *     def SAD(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_49SAD, 0, __pyx_n_s_USB488_device_SAD, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SAD, __pyx_t_5) < 0) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":767
 *         self.write("*SDS")
 * 
 *     def SDS(self):             # <<<<<<<<<<<<<<
 *         self.write("*SDS")
 *     #
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_51SDS, 0, __pyx_n_s_USB488_device_SDS, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SDS_2, __pyx_t_5) < 0) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":770
 *         self.write("*SDS")
 *     #
 *     def OPT(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*OPT?\n")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_53OPT, 0, __pyx_n_s_USB488_device_OPT, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__154)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_OPT_2, __pyx_t_5) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":773
 *         return self.ask("*OPT?\n")
 * 
 *     def TER(self):             # <<<<<<<<<<<<<<
 *         return self.ask("*TER?\n")
 *     #
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_55TER, 0, __pyx_n_s_USB488_device_TER, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__156)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TER_2, __pyx_t_5) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":776
 *         return self.ask("*TER?\n")
 *     #
 *     def RemoteEnable(self,enable=True):#Table 15             # <<<<<<<<<<<<<<
 *         if enable:
 *             b=self.device.ctrl_transfer(
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_57RemoteEnable, 0, __pyx_n_s_USB488_device_RemoteEnable, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__158)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__159);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RemoteEnable, __pyx_t_5) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":798
 *         return b #USBTMC_Status
 * 
 *     def LocalLockOut(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_59LocalLockOut, 0, __pyx_n_s_USB488_device_LocalLockOut, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__161)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_LocalLockOut, __pyx_t_5) < 0) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":809
 *         return b #USBTMC_Status
 * 
 *     def GoToLocal(self):             # <<<<<<<<<<<<<<
 *         b=self.device.ctrl_transfer(
 *             build_request_type(CTRL_IN, CTRL_TYPE_CLASS,
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_61GoToLocal, 0, __pyx_n_s_USB488_device_GoToLocal, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__163)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_GoToLocal, __pyx_t_5) < 0) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":820
 *         return b #USBTMC_Status
 * 
 *     def Read_Status_Byte(self):             # <<<<<<<<<<<<<<
 *         # see Table 9,
 *         b=self.device.ctrl_transfer(
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_63Read_Status_Byte, 0, __pyx_n_s_USB488_device_Read_Status_Byte, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__165)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_Read_Status_Byte, __pyx_t_5) < 0) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":838
 *             return USB488_Status(b)
 * 
 *     def TRIGGER(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             btag,h=mkTriggerHeader()
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_65TRIGGER, 0, __pyx_n_s_USB488_device_TRIGGER, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__167)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TRIGGER, __pyx_t_5) < 0) __PYX_ERR(0, 838, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":849
 *                 raise
 * 
 *     def GetExecuteTrigger(self):             # <<<<<<<<<<<<<<
 *         if self.capabilities.DT1:
 *             self.TRIGGER()
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_67GetExecuteTrigger, 0, __pyx_n_s_USB488_device_GetExecuteTrigger, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_GetExecuteTrigger, __pyx_t_5) < 0) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":855
 *             self.TRG()
 * 
 *     def SelectedDeviceClear(self):#table 26             # <<<<<<<<<<<<<<
 *         self.clear()
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_69SelectedDeviceClear, 0, __pyx_n_s_USB488_device_SelectedDeviceClea, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__171)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SelectedDeviceClear, __pyx_t_5) < 0) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":863
 *     #         ent.clear()
 * 
 *     def DCL(self):             # <<<<<<<<<<<<<<
 *         """
 *         send DCL(Device CLear)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13USB488_device_71DCL, 0, __pyx_n_s_USB488_device_DCL, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_DCL_2, __pyx_t_5) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":666
 *             raise USBError("INDICATOR_PULSE is not supported on this device")
 * 
 * class USB488_device(USBTMC_device):             # <<<<<<<<<<<<<<
 *     #mandatory commands
 *     def CLS(self):
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_USB488_device, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USB488_device, __pyx_t_5) < 0) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":875
 *     #         ent.LocalLockOut()
 * 
 * class USBTMC_Capabilities:             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_USBTMC_Capabilities, __pyx_n_s_USBTMC_Capabilities, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":876
 * 
 * class USBTMC_Capabilities:
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 *         if (bytes[4]&0x4):
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_19USBTMC_Capabilities_1__init__, 0, __pyx_n_s_USBTMC_Capabilities___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__175)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":933
 *                 self.DT1=False
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         msg=""
 *         if self.indicator_pulse:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_19USBTMC_Capabilities_3__str__, 0, __pyx_n_s_USBTMC_Capabilities___str, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__177)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_str, __pyx_t_1) < 0) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":875
 *     #         ent.LocalLockOut()
 * 
 * class USBTMC_Capabilities:             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         self.bcdUSBTMC="0x%.2x%.2x"%(bytes[3],bytes[2])
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_USBTMC_Capabilities, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_USBTMC_Capabilities, __pyx_t_1) < 0) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":946
 * 
 * # bTag generator
 * class bTag:             # <<<<<<<<<<<<<<
 *     __lastbtag=0
 *     @classmethod
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_bTag, __pyx_n_s_bTag, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":947
 * # bTag generator
 * class bTag:
 *     __lastbtag=0             # <<<<<<<<<<<<<<
 *     @classmethod
 *     def next(cls):
 */
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_bTag__lastbtag, __pyx_int_0) < 0) __PYX_ERR(0, 947, __pyx_L1_error)

  /* "cPyUSBTMC.pyx":949
 *     __lastbtag=0
 *     @classmethod
 *     def next(cls):             # <<<<<<<<<<<<<<
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 *                          if (cls.__lastbtag < 0xff) else 1)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_4bTag_1next, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_bTag_next, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cPyUSBTMC.pyx":948
 * class bTag:
 *     __lastbtag=0
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def next(cls):
 *         cls.__lastbtag=( (cls.__lastbtag + 1) & 0xff
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_next, __pyx_t_3) < 0) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cPyUSBTMC.pyx":954
 *         return cls.__lastbtag
 *     @classmethod
 *     def last(cls):             # <<<<<<<<<<<<<<
 *         return cls.__lastbtag
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_4bTag_3last, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_bTag_last, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__181)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":953
 *                          if (cls.__lastbtag < 0xff) else 1)
 *         return cls.__lastbtag
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def last(cls):
 *         return cls.__lastbtag
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_last, __pyx_t_1) < 0) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":946
 * 
 * # bTag generator
 * class bTag:             # <<<<<<<<<<<<<<
 *     __lastbtag=0
 *     @classmethod
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_bTag, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bTag, __pyx_t_1) < 0) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":957
 *         return cls.__lastbtag
 * 
 * def mkCommonHeader(msgid):             # <<<<<<<<<<<<<<
 *     btag=bTag.next()
 *     h="%1c%1c%1c\0"%(msgid&0xff, btag, (~btag)&0xff) # USBTMC spec table 1.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_3mkCommonHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkCommonHeader, __pyx_t_2) < 0) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":963
 * 
 * 
 * def mkTriggerHeader():             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.TRIGGER)
 *     h="%s\0\0\0\0\0\0\0\0"%(h)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_5mkTriggerHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkTriggerHeader, __pyx_t_2) < 0) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":968
 *     return (btag,h)
 * 
 * def mkDevDepMSGOUTHeader(tsize, eom=False):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_OUT)
 *     if eom:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_7mkDevDepMSGOUTHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkDevDepMSGOUTHeader, __pyx_t_2) < 0) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":984
 *     return (btag,h)
 * 
 * def mkReqDevDepMSGINHeader(tsize, TermCharEnable, TermChar='\n'):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.DEV_DEP_MSG_IN)
 *     if TermCharEnable:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_9mkReqDevDepMSGINHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkReqDevDepMSGINHeader, __pyx_t_2) < 0) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1003
 * 
 * 
 * def mkVendorSpecMSGOUTHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_OUT)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_11mkVendorSpecMSGOUTHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkVendorSpecMSGOUTHeader, __pyx_t_2) < 0) __PYX_ERR(0, 1003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1013
 *     return (btag,h)
 * 
 * def mkReqVendorSpecMSGINHeader(tsize):             # <<<<<<<<<<<<<<
 *     btag,h=mkCommonHeader(USBTMC_MsgID.VENDOR_SPECIFIC_IN)
 *     h="%s%1c%1c%1c%1c\0\0\0\0"%(h,
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_13mkReqVendorSpecMSGINHeader, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mkReqVendorSpecMSGINHeader, __pyx_t_2) < 0) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1023
 *     return (btag,h)
 * 
 * class BulkIn_Header:             # <<<<<<<<<<<<<<
 *     """
 *     convert return value header to structure
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BulkIn_Header, __pyx_n_s_BulkIn_Header, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, __pyx_kp_s_convert_return_value_header_to); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":1027
 *     convert return value header to structure
 *     """
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         self.msgID=bytes[0]
 *         self.bTag=bytes[1]
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_13BulkIn_Header_1__init__, 0, __pyx_n_s_BulkIn_Header___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__195)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 1027, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1023
 *     return (btag,h)
 * 
 * class BulkIn_Header:             # <<<<<<<<<<<<<<
 *     """
 *     convert return value header to structure
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BulkIn_Header, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BulkIn_Header, __pyx_t_1) < 0) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1037
 *             self.data=None
 * 
 * class DevDep_Responce(BulkIn_Header):             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BulkIn_Header); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_DevDep_Responce, __pyx_n_s_DevDep_Responce, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":1038
 * 
 * class DevDep_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.DEV_DEP_MSG_IN :
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_15DevDep_Responce_1__init__, 0, __pyx_n_s_DevDep_Responce___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__197)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1037
 *             self.data=None
 * 
 * class DevDep_Responce(BulkIn_Header):             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_DevDep_Responce, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DevDep_Responce, __pyx_t_5) < 0) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1050
 *         self.eom=self.resMsg[4]&0x1
 * 
 * class VendorSpec_Responce(BulkIn_Header):             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BulkIn_Header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_VendorSpec_Responce, __pyx_n_s_VendorSpec_Responce, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cPyUSBTMC.pyx":1051
 * 
 * class VendorSpec_Responce(BulkIn_Header):
 *     def __init__(self,bytes):             # <<<<<<<<<<<<<<
 *         BulkIn_Header.__init__(self, bytes)
 *         if self.msgID != USBTMC_MsgID.VENDOR_SPECIFIC_IN :
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_19VendorSpec_Responce_1__init__, 0, __pyx_n_s_VendorSpec_Responce___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__199)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cPyUSBTMC.pyx":1050
 *         self.eom=self.resMsg[4]&0x1
 * 
 * class VendorSpec_Responce(BulkIn_Header):             # <<<<<<<<<<<<<<
 *     def __init__(self,bytes):
 *         BulkIn_Header.__init__(self, bytes)
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VendorSpec_Responce, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VendorSpec_Responce, __pyx_t_5) < 0) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1060
 *                              (self.resMsg[3]<<24))
 * #
 * class Interrupt_IN_Data:# Table 6, USB488             # <<<<<<<<<<<<<<
 *     def __init__(self, bytes):
 *         self.SBR=None
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Interrupt_IN_Data, __pyx_n_s_Interrupt_IN_Data, (PyObject *) NULL, __pyx_n_s_cPyUSBTMC, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cPyUSBTMC.pyx":1061
 * #
 * class Interrupt_IN_Data:# Table 6, USB488
 *     def __init__(self, bytes):             # <<<<<<<<<<<<<<
 *         self.SBR=None
 *         self.statusBytes=None
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9cPyUSBTMC_17Interrupt_IN_Data_1__init__, 0, __pyx_n_s_Interrupt_IN_Data___init, NULL, __pyx_n_s_cPyUSBTMC, __pyx_d, ((PyObject *)__pyx_codeobj__201)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cPyUSBTMC.pyx":1060
 *                              (self.resMsg[3]<<24))
 * #
 * class Interrupt_IN_Data:# Table 6, USB488             # <<<<<<<<<<<<<<
 *     def __init__(self, bytes):
 *         self.SBR=None
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Interrupt_IN_Data, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Interrupt_IN_Data, __pyx_t_1) < 0) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1072
 *             self.statusBytes=bytes[1:]
 * #
 * def test():             # <<<<<<<<<<<<<<
 *     #import usb.core, usb.util,usb.backend,usb.backend.libusb1
 *     #dev=usb.core.find(idVendor=0x0957, idProduct=0x0407)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_15test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1117
 *         return tmcdev
 * 
 * def DSO6K_test(dev=None):             # <<<<<<<<<<<<<<
 *     import Gnuplot
 *     if not dev:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_17DSO6K_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DSO6K_test, __pyx_t_2) < 0) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1143
 *     return dev
 * 
 * def DSO6K_test_pylab(dev=None):             # <<<<<<<<<<<<<<
 *     import pylab
 *     if not dev:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_19DSO6K_test_pylab, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DSO6K_test_pylab, __pyx_t_2) < 0) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1171
 *     return dev
 * 
 * def DPO4K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_21DPO4K_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DPO4K_test, __pyx_t_2) < 0) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1193
 *     return dev
 * 
 * def DPO3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     dev=test()
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_23DPO3K_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DPO3K_test, __pyx_t_2) < 0) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1215
 *     return dev
 * 
 * def SL1K_test():             # <<<<<<<<<<<<<<
 *     import pylab
 *     dev=test()
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_25SL1K_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SL1K_test, __pyx_t_2) < 0) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1243
 *     return dev
 * 
 * def AFG3K_test():             # <<<<<<<<<<<<<<
 *     import pylab,time
 *     devs=find_tmc_devices() #
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_27AFG3K_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AFG3K_test, __pyx_t_2) < 0) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1253
 *     AFG3K_setup_test(dev)
 * 
 * def AFG3K_setup_test(dev):             # <<<<<<<<<<<<<<
 *     import pylab
 *     #'Set CH1 output parameters
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9cPyUSBTMC_29AFG3K_setup_test, NULL, __pyx_n_s_cPyUSBTMC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AFG3K_setup_test, __pyx_t_2) < 0) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cPyUSBTMC.pyx":1
 * #!/usr/bin/env python             # <<<<<<<<<<<<<<
 * #-*- coding: utf-8 -*-
 * """
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init cPyUSBTMC", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cPyUSBTMC");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

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

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

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

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

/* CythonFunctionShared */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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 = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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 = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **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_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
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    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;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RshiftObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            return PyInt_FromLong(a >> b);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_rshift(op1, op2);
            }
        }
                x = a >> b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla >> llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRshift : PyNumber_Rshift)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            return PyInt_FromLong(a & b);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_and(op1, op2);
            }
        }
                x = a & b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla & llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2);
}
#endif

/* GetItemInt */
static 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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        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))
                        return NULL;
                    PyErr_Clear();
                }
            }
            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));
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

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

/* PyObjectCallOneArg */
#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) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#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

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if 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 = __Pyx_PyThreadState_Current;
        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

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* BytesEquals */
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;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_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
}

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_RemainderObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
            x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
            }
        }
                __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
                x = a % b;
                x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_LshiftObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            if (likely(b < (long) (sizeof(long)*8) && a == (a << b) >> b) || !a) {
                return PyInt_FromLong(a << b);
            }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_lshift(op1, op2);
            }
        }
                x = a << b;
#ifdef HAVE_LONG_LONG
                if (unlikely(!(b < (long) (sizeof(long)*8) && a == x >> b)) && a) {
                    lla = a;
                    goto long_long;
                }
#else
                if (likely(b < (long) (sizeof(long)*8) && a == x >> b) || !a)
#endif
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla << llb;
                if (likely(lla == llx >> llb))
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceLshift : PyNumber_Lshift)(op1, op2);
}
#endif

/* Import */
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_MAJOR_VERSION < 3
    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 ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* ImportFrom */
  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* ClassMethod */
  static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY
    if (PyMethodDescr_Check(method))
#else
    #if PY_MAJOR_VERSION == 2
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    #else
    PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
    #endif
    if (__Pyx_TypeCheck(method, methoddescr_type))
#endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else {
        return PyClassMethod_New(method);
    }
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #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;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        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(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* Print */
  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 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_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(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;
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 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_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(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;
}

/* FastTypeChecks */
  #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

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

/* InitStrings */
  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;
        if (PyObject_Hash(*t->p) == -1)
            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 const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
