/* Generated by Cython 0.29.24 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "extra_compile_args": [
            "-std=c++17",
            "-Wno-register",
            "-Wno-deprecated-declarations",
            "-Wno-unused-function",
            "-Wno-unused-local-typedefs",
            "-funsigned-char"
        ],
        "language": "c++",
        "libraries": [
            "fstmpdtscript",
            "fstpdtscript",
            "fstfarscript",
            "fstfar",
            "fstscript",
            "fst",
            "m",
            "dl"
        ],
        "name": "_pynini",
        "sources": [
            "extensions/_pynini.pyx",
            "extensions/cdrewritescript.cc",
            "extensions/concatrangescript.cc",
            "extensions/crossscript.cc",
            "extensions/defaults.cc",
            "extensions/getters.cc",
            "extensions/lenientlycomposescript.cc",
            "extensions/optimizescript.cc",
            "extensions/pathsscript.cc",
            "extensions/stringcompile.cc",
            "extensions/stringcompilescript.cc",
            "extensions/stringfile.cc",
            "extensions/stringmapscript.cc",
            "extensions/stringprintscript.cc",
            "extensions/stringutil.cc"
        ]
    },
    "module_name": "_pynini"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* 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_24"
#define CYTHON_HEX_VERSION 0x001D18F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#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 __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#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
  #if defined(PyUnicode_IS_READY)
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #else
  #define __Pyx_PyUnicode_READY(op)       (0)
  #endif
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         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)
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #endif
  #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___pynini
#define __PYX_HAVE_API___pynini
/* Early includes */
#include <stdint.h>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <memory>
#include <utility>

    #if __cplusplus > 199711L
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include <string.h>
#include <string>
#include <vector>
#include <fst/compat.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <fst/util.h>
#include <fst/fstlib.h>
#include <fst/script/fstscript.h>
#include <fst/script/getters.h>
#include <fst/extensions/far/far.h>
#include <fst/extensions/far/getters.h>
#include <fst/extensions/far/far-class.h>
#include <fst/extensions/mpdt/compose.h>
#include <fst/extensions/mpdt/expand.h>
#include <fst/extensions/mpdt/mpdtscript.h>
#include <fst/extensions/mpdt/read_write_utils.h>
#include <fst/extensions/pdt/compose.h>
#include <fst/extensions/pdt/replace.h>
#include <fst/extensions/pdt/getters.h>
#include <fst/extensions/pdt/pdtscript.h>
#include "cdrewrite.h"
#include "cdrewritescript.h"
#include "concatrangescript.h"
#include "getters.h"
#include "crossscript.h"
#include "lenientlycomposescript.h"
#include "optimizescript.h"
#include "pathsscript.h"
#include "defaults.h"
#include "stringutil.h"
#include "stringcompile.h"
#include "stringcompilescript.h"
#include "stringmapscript.h"
#include "stringprintscript.h"
#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 1
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING "utf8"
#define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_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[] = {
  "extensions/_pynini.pyx",
  "stringsource",
  "extensions/_pywrapfst.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_10_pywrapfst_Weight;
struct __pyx_obj_10_pywrapfst_SymbolTableView;
struct __pyx_obj_10_pywrapfst__EncodeMapperSymbolTableView;
struct __pyx_obj_10_pywrapfst__FstSymbolTableView;
struct __pyx_obj_10_pywrapfst__MutableSymbolTable;
struct __pyx_obj_10_pywrapfst__MutableFstSymbolTableView;
struct __pyx_obj_10_pywrapfst_SymbolTable;
struct __pyx_obj_10_pywrapfst__SymbolTableIterator;
struct __pyx_obj_10_pywrapfst_EncodeMapper;
struct __pyx_obj_10_pywrapfst_Fst;
struct __pyx_obj_10_pywrapfst_MutableFst;
struct __pyx_obj_10_pywrapfst_VectorFst;
struct __pyx_obj_10_pywrapfst_Arc;
struct __pyx_obj_10_pywrapfst__ArcIterator;
struct __pyx_obj_10_pywrapfst__MutableArcIterator;
struct __pyx_obj_10_pywrapfst__StateIterator;
struct __pyx_obj_10_pywrapfst_Compiler;
struct __pyx_obj_10_pywrapfst_FarReader;
struct __pyx_obj_10_pywrapfst_FarWriter;
struct __pyx_obj_7_pynini_Fst;
struct __pyx_obj_7_pynini__PointerSymbolTableView;
struct __pyx_obj_7_pynini_PdtParentheses;
struct __pyx_obj_7_pynini_MPdtParentheses;
struct __pyx_obj_7_pynini__StringPathIterator;
struct __pyx_obj_7_pynini_Far;
struct __pyx_obj_7_pynini___pyx_scope_struct__union;
struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr;
struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch;
struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch;
struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch;
struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch;
struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch;
struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__;
struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__;
struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings;
struct __pyx_obj_7_pynini___pyx_scope_struct_10_items;
struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings;
struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights;
struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch;

/* "cpywrapfst.pxd":516
 * 
 * 
 * ctypedef pair[int64_t, const FstClass *] LabelFstClassPair             # <<<<<<<<<<<<<<
 * 
 * ctypedef pair[int64_t, int64_t] LabelPair
 */
typedef std::pair<int64_t,fst::script::FstClass const *>  __pyx_t_10cpywrapfst_LabelFstClassPair;

/* "cpywrapfst.pxd":518
 * ctypedef pair[int64_t, const FstClass *] LabelFstClassPair
 * 
 * ctypedef pair[int64_t, int64_t] LabelPair             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef std::pair<int64_t,int64_t>  __pyx_t_10cpywrapfst_LabelPair;
struct __pyx_opt_args_10_pywrapfst_19_MutableSymbolTable_add_symbol;
struct __pyx_opt_args_10_pywrapfst_3Fst_draw;
struct __pyx_opt_args_10_pywrapfst_3Fst_print;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__arcsort;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__closure;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_arcs;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_states;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__minimize;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__prune;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__push;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_pairs;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_tables;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__reweight;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__rmepsilon;
struct __pyx_opt_args_10_pywrapfst_10MutableFst__set_final;
struct __pyx_opt_args_10_pywrapfst__map;
struct __pyx_opt_args_10_pywrapfst_arcmap;
struct __pyx_opt_args_10_pywrapfst_compose;
struct __pyx_opt_args_10_pywrapfst_convert;
struct __pyx_opt_args_10_pywrapfst_determinize;
struct __pyx_opt_args_10_pywrapfst_difference;
struct __pyx_opt_args_10_pywrapfst_disambiguate;
struct __pyx_opt_args_10_pywrapfst_epsnormalize;
struct __pyx_opt_args_10_pywrapfst_equal;
struct __pyx_opt_args_10_pywrapfst_equivalent;
struct __pyx_opt_args_10_pywrapfst_intersect;
struct __pyx_opt_args_10_pywrapfst_isomorphic;
struct __pyx_opt_args_10_pywrapfst_prune;
struct __pyx_opt_args_10_pywrapfst_push;
struct __pyx_opt_args_10_pywrapfst_randequivalent;
struct __pyx_opt_args_10_pywrapfst_randgen;
struct __pyx_opt_args_10_pywrapfst_replace;
struct __pyx_opt_args_10_pywrapfst_reverse;
struct __pyx_opt_args_10_pywrapfst__shortestdistance;
struct __pyx_opt_args_10_pywrapfst_shortestpath;

/* "_pywrapfst.pxd":104
 * # SymbolTable.
 * 
 * ctypedef fst.SymbolTable * SymbolTable_ptr             # <<<<<<<<<<<<<<
 * ctypedef const fst.SymbolTable * const_SymbolTable_ptr
 * 
 */
typedef fst::SymbolTable *__pyx_t_10_pywrapfst_SymbolTable_ptr;

/* "_pywrapfst.pxd":105
 * 
 * ctypedef fst.SymbolTable * SymbolTable_ptr
 * ctypedef const fst.SymbolTable * const_SymbolTable_ptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef fst::SymbolTable const *__pyx_t_10_pywrapfst_const_SymbolTable_ptr;

/* "_pywrapfst.pxd":161
 *   cdef fst.SymbolTable *_mutable_raw_ptr_or_raise(self) except *
 * 
 *   cpdef int64_t add_symbol(self, symbol, int64_t key=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cpdef void add_table(self, SymbolTableView syms) except *
 */
struct __pyx_opt_args_10_pywrapfst_19_MutableSymbolTable_add_symbol {
  int __pyx_n;
  int64_t key;
};

/* "_pywrapfst.pxd":208
 * 
 * 
 * ctypedef fst.EncodeMapperClass * EncodeMapperClass_ptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef fst::script::EncodeMapperClass *__pyx_t_10_pywrapfst_EncodeMapperClass_ptr;

/* "_pywrapfst.pxd":242
 * 
 * 
 * ctypedef fst.FstClass * FstClass_ptr             # <<<<<<<<<<<<<<
 * ctypedef const fst.FstClass * const_FstClass_ptr
 * ctypedef fst.MutableFstClass * MutableFstClass_ptr
 */
typedef fst::script::FstClass *__pyx_t_10_pywrapfst_FstClass_ptr;

/* "_pywrapfst.pxd":243
 * 
 * ctypedef fst.FstClass * FstClass_ptr
 * ctypedef const fst.FstClass * const_FstClass_ptr             # <<<<<<<<<<<<<<
 * ctypedef fst.MutableFstClass * MutableFstClass_ptr
 * ctypedef fst.VectorFstClass * VectorFstClass_ptr
 */
typedef fst::script::FstClass const *__pyx_t_10_pywrapfst_const_FstClass_ptr;

/* "_pywrapfst.pxd":244
 * ctypedef fst.FstClass * FstClass_ptr
 * ctypedef const fst.FstClass * const_FstClass_ptr
 * ctypedef fst.MutableFstClass * MutableFstClass_ptr             # <<<<<<<<<<<<<<
 * ctypedef fst.VectorFstClass * VectorFstClass_ptr
 * 
 */
typedef fst::script::MutableFstClass *__pyx_t_10_pywrapfst_MutableFstClass_ptr;

/* "_pywrapfst.pxd":245
 * ctypedef const fst.FstClass * const_FstClass_ptr
 * ctypedef fst.MutableFstClass * MutableFstClass_ptr
 * ctypedef fst.VectorFstClass * VectorFstClass_ptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef fst::script::VectorFstClass *__pyx_t_10_pywrapfst_VectorFstClass_ptr;

/* "_pywrapfst.pxd":261
 *   cpdef Fst copy(self)
 * 
 *   cpdef void draw(self,             # <<<<<<<<<<<<<<
 *                   source,
 *                   SymbolTableView isymbols=?,
 */
struct __pyx_opt_args_10_pywrapfst_3Fst_draw {
  int __pyx_n;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *isymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *osymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *ssymbols;
  bool acceptor;
  PyObject *title;
  double width;
  double height;
  bool portrait;
  bool vertical;
  double ranksep;
  double nodesep;
  int32_t fontsize;
  int32_t precision;
  PyObject *float_format;
  bool show_weight_one;
};

/* "_pywrapfst.pxd":293
 *   cpdef _FstSymbolTableView output_symbols(self)
 * 
 *   cpdef string print(self,             # <<<<<<<<<<<<<<
 *                     SymbolTableView isymbols=?,
 *                     SymbolTableView osymbols=?,
 */
struct __pyx_opt_args_10_pywrapfst_3Fst_print {
  int __pyx_n;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *isymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *osymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *ssymbols;
  bool acceptor;
  bool show_weight_one;
  PyObject *missing_sym;
};

/* "_pywrapfst.pxd":326
 *   cpdef void add_states(self, size_t)
 * 
 *   cdef void _arcsort(self, sort_type=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _closure(self, closure_type=?)
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__arcsort {
  int __pyx_n;
  PyObject *sort_type;
};

/* "_pywrapfst.pxd":328
 *   cdef void _arcsort(self, sort_type=?) except *
 * 
 *   cdef void _closure(self, closure_type=?)             # <<<<<<<<<<<<<<
 * 
 *   cdef void _concat(self, Fst fst2) except *
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__closure {
  int __pyx_n;
  PyObject *closure_type;
};

/* "_pywrapfst.pxd":336
 *   cdef void _decode(self, EncodeMapper) except *
 * 
 *   cdef void _delete_arcs(self, int64_t state, size_t n=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _delete_states(self, states=?) except *
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_arcs {
  int __pyx_n;
  size_t n;
};

/* "_pywrapfst.pxd":338
 *   cdef void _delete_arcs(self, int64_t state, size_t n=?) except *
 * 
 *   cdef void _delete_states(self, states=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _encode(self, EncodeMapper) except *
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_states {
  int __pyx_n;
  PyObject *states;
};

/* "_pywrapfst.pxd":344
 *   cdef void _invert(self)
 * 
 *   cdef void _minimize(self, float delta=?, bool allow_nondet=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cpdef _MutableArcIterator mutable_arcs(self, int64_t state)
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__minimize {
  int __pyx_n;
  float delta;
  bool allow_nondet;
};

/* "_pywrapfst.pxd":352
 *   cdef void _project(self, project_type) except *
 * 
 *   cdef void _prune(self, float delta=?, int64_t nstate=?, weight=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _push(self,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__prune {
  int __pyx_n;
  float delta;
  int64_t nstate;
  PyObject *weight;
};

/* "_pywrapfst.pxd":354
 *   cdef void _prune(self, float delta=?, int64_t nstate=?, weight=?) except *
 * 
 *   cdef void _push(self,             # <<<<<<<<<<<<<<
 *                   float delta=?,
 *                   bool remove_total_weight=?,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__push {
  int __pyx_n;
  float delta;
  bool remove_total_weight;
  PyObject *reweight_type;
};

/* "_pywrapfst.pxd":359
 *                   reweight_type=?)
 * 
 *   cdef void _relabel_pairs(self, ipairs=?, opairs=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _relabel_tables(self,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_pairs {
  int __pyx_n;
  PyObject *ipairs;
  PyObject *opairs;
};

/* "_pywrapfst.pxd":361
 *   cdef void _relabel_pairs(self, ipairs=?, opairs=?) except *
 * 
 *   cdef void _relabel_tables(self,             # <<<<<<<<<<<<<<
 *                             SymbolTableView old_isymbols=?,
 *                             SymbolTableView new_isymbols=?,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_tables {
  int __pyx_n;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *old_isymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *new_isymbols;
  PyObject *unknown_isymbol;
  bool attach_new_isymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *old_osymbols;
  struct __pyx_obj_10_pywrapfst_SymbolTableView *new_osymbols;
  PyObject *unknown_osymbol;
  bool attach_new_osymbols;
};

/* "_pywrapfst.pxd":375
 *   cdef void _reserve_states(self, int64_t n)
 * 
 *   cdef void _reweight(self, potentials, reweight_type=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _rmepsilon(self,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__reweight {
  int __pyx_n;
  PyObject *reweight_type;
};

/* "_pywrapfst.pxd":377
 *   cdef void _reweight(self, potentials, reweight_type=?) except *
 * 
 *   cdef void _rmepsilon(self,             # <<<<<<<<<<<<<<
 *                        queue_type=?,
 *                        bool connect=?,
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__rmepsilon {
  int __pyx_n;
  PyObject *queue_type;
  bool connect;
  PyObject *weight;
  int64_t nstate;
  float delta;
};

/* "_pywrapfst.pxd":384
 *                        float delta=?) except *
 * 
 *   cdef void _set_final(self, int64_t state, weight=?) except *             # <<<<<<<<<<<<<<
 * 
 *   cdef void _set_start(self, int64_t state) except *
 */
struct __pyx_opt_args_10_pywrapfst_10MutableFst__set_final {
  int __pyx_n;
  PyObject *weight;
};

/* "_pywrapfst.pxd":492
 * 
 * 
 * cdef Fst _map(Fst ifst, float delta=?, map_type=?, double power=?, weight=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef Fst arcmap(Fst ifst, float delta=?, map_type=?, double power=?, weight=?)
 */
struct __pyx_opt_args_10_pywrapfst__map {
  int __pyx_n;
  float delta;
  PyObject *map_type;
  double power;
  PyObject *weight;
};

/* "_pywrapfst.pxd":494
 * cdef Fst _map(Fst ifst, float delta=?, map_type=?, double power=?, weight=?)
 * 
 * cpdef Fst arcmap(Fst ifst, float delta=?, map_type=?, double power=?, weight=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef MutableFst compose(Fst ifst1,
 */
struct __pyx_opt_args_10_pywrapfst_arcmap {
  int __pyx_n;
  float delta;
  PyObject *map_type;
  double power;
  PyObject *weight;
};

/* "_pywrapfst.pxd":496
 * cpdef Fst arcmap(Fst ifst, float delta=?, map_type=?, double power=?, weight=?)
 * 
 * cpdef MutableFst compose(Fst ifst1,             # <<<<<<<<<<<<<<
 *                          Fst ifst2,
 *                          compose_filter=?,
 */
struct __pyx_opt_args_10_pywrapfst_compose {
  int __pyx_n;
  PyObject *compose_filter;
  bool connect;
};

/* "_pywrapfst.pxd":501
 *                          bool connect=?)
 * 
 * cpdef Fst convert(Fst ifst, fst_type=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef MutableFst determinize(Fst ifst,
 */
struct __pyx_opt_args_10_pywrapfst_convert {
  int __pyx_n;
  PyObject *fst_type;
};

/* "_pywrapfst.pxd":503
 * cpdef Fst convert(Fst ifst, fst_type=?)
 * 
 * cpdef MutableFst determinize(Fst ifst,             # <<<<<<<<<<<<<<
 *                              float delta=?,
 *                              det_type=?,
 */
struct __pyx_opt_args_10_pywrapfst_determinize {
  int __pyx_n;
  float delta;
  PyObject *det_type;
  int64_t nstate;
  int64_t subsequential_label;
  PyObject *weight;
  bool increment_subsequential_label;
};

/* "_pywrapfst.pxd":511
 *                              bool increment_subsequential_label=?)
 * 
 * cpdef MutableFst difference(Fst ifst1,             # <<<<<<<<<<<<<<
 *                             Fst ifst2,
 *                             compose_filter=?,
 */
struct __pyx_opt_args_10_pywrapfst_difference {
  int __pyx_n;
  PyObject *compose_filter;
  bool connect;
};

/* "_pywrapfst.pxd":516
 *                             bool connect=?)
 * 
 * cpdef MutableFst disambiguate(Fst ifst,             # <<<<<<<<<<<<<<
 *                               float delta=?,
 *                               int64_t nstate=?,
 */
struct __pyx_opt_args_10_pywrapfst_disambiguate {
  int __pyx_n;
  float delta;
  int64_t nstate;
  int64_t subsequential_label;
  PyObject *weight;
};

/* "_pywrapfst.pxd":522
 *                               weight=?)
 * 
 * cpdef MutableFst epsnormalize(Fst ifst, eps_norm_type=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef bool equal(Fst ifst1, Fst ifst2, float delta=?)
 */
struct __pyx_opt_args_10_pywrapfst_epsnormalize {
  int __pyx_n;
  PyObject *eps_norm_type;
};

/* "_pywrapfst.pxd":524
 * cpdef MutableFst epsnormalize(Fst ifst, eps_norm_type=?)
 * 
 * cpdef bool equal(Fst ifst1, Fst ifst2, float delta=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef bool equivalent(Fst ifst1, Fst ifst2, float delta=?) except *
 */
struct __pyx_opt_args_10_pywrapfst_equal {
  int __pyx_n;
  float delta;
};

/* "_pywrapfst.pxd":526
 * cpdef bool equal(Fst ifst1, Fst ifst2, float delta=?)
 * 
 * cpdef bool equivalent(Fst ifst1, Fst ifst2, float delta=?) except *             # <<<<<<<<<<<<<<
 * 
 * cpdef MutableFst intersect(Fst ifst1,
 */
struct __pyx_opt_args_10_pywrapfst_equivalent {
  int __pyx_n;
  float delta;
};

/* "_pywrapfst.pxd":528
 * cpdef bool equivalent(Fst ifst1, Fst ifst2, float delta=?) except *
 * 
 * cpdef MutableFst intersect(Fst ifst1,             # <<<<<<<<<<<<<<
 *                            Fst ifst2,
 *                            compose_filter=?,
 */
struct __pyx_opt_args_10_pywrapfst_intersect {
  int __pyx_n;
  PyObject *compose_filter;
  bool connect;
};

/* "_pywrapfst.pxd":533
 *                            bool connect=?)
 * 
 * cpdef bool isomorphic(Fst ifst1, Fst ifst2, float delta=?)             # <<<<<<<<<<<<<<
 * 
 * cpdef MutableFst prune(Fst ifst,
 */
struct __pyx_opt_args_10_pywrapfst_isomorphic {
  int __pyx_n;
  float delta;
};

/* "_pywrapfst.pxd":535
 * cpdef bool isomorphic(Fst ifst1, Fst ifst2, float delta=?)
 * 
 * cpdef MutableFst prune(Fst ifst,             # <<<<<<<<<<<<<<
 *                        float delta=?,
 *                        int64_t nstate=?,
 */
struct __pyx_opt_args_10_pywrapfst_prune {
  int __pyx_n;
  float delta;
  int64_t nstate;
  PyObject *weight;
};

/* "_pywrapfst.pxd":540
 *                        weight=?)
 * 
 * cpdef MutableFst push(Fst ifst,             # <<<<<<<<<<<<<<
 *                       float delta=?,
 *                       bool push_weights=?,
 */
struct __pyx_opt_args_10_pywrapfst_push {
  int __pyx_n;
  float delta;
  bool push_weights;
  bool push_labels;
  bool remove_common_affix;
  bool remove_total_weight;
  PyObject *reweight_type;
};

/* "_pywrapfst.pxd":548
 *                       reweight_type=?)
 * 
 * cpdef bool randequivalent(Fst ifst1,             # <<<<<<<<<<<<<<
 *                           Fst ifst2,
 *                           int32_t npath=?,
 */
struct __pyx_opt_args_10_pywrapfst_randequivalent {
  int __pyx_n;
  int32_t npath;
  float delta;
  PyObject *select;
  int32_t max_length;
  uint64_t seed;
};

/* "_pywrapfst.pxd":556
 *                           uint64_t seed=?) except *
 * 
 * cpdef MutableFst randgen(Fst ifst,             # <<<<<<<<<<<<<<
 *                          int32_t npath=?,
 *                          select=?,
 */
struct __pyx_opt_args_10_pywrapfst_randgen {
  int __pyx_n;
  int32_t npath;
  PyObject *select;
  int32_t max_length;
  bool remove_total_weight;
  bool weighted;
  uint64_t seed;
};

/* "_pywrapfst.pxd":564
 *                          uint64_t seed=?)
 * 
 * cpdef MutableFst replace(pairs,             # <<<<<<<<<<<<<<
 *                          call_arc_labeling=?,
 *                          return_arc_labeling=?,
 */
struct __pyx_opt_args_10_pywrapfst_replace {
  int __pyx_n;
  PyObject *call_arc_labeling;
  PyObject *return_arc_labeling;
  bool epsilon_on_replace;
  int64_t return_label;
};

/* "_pywrapfst.pxd":570
 *                          int64_t return_label=?)
 * 
 * cpdef MutableFst reverse(Fst ifst, bool require_superinitial=?)             # <<<<<<<<<<<<<<
 * 
 * cdef void _shortestdistance(Fst ifst,
 */
struct __pyx_opt_args_10_pywrapfst_reverse {
  int __pyx_n;
  bool require_superinitial;
};

/* "_pywrapfst.pxd":572
 * cpdef MutableFst reverse(Fst ifst, bool require_superinitial=?)
 * 
 * cdef void _shortestdistance(Fst ifst,             # <<<<<<<<<<<<<<
 *                             vector[fst.WeightClass] *,
 *                             float delta=?,
 */
struct __pyx_opt_args_10_pywrapfst__shortestdistance {
  int __pyx_n;
  float delta;
  int64_t nstate;
  PyObject *queue_type;
  bool reverse;
};

/* "_pywrapfst.pxd":579
 *                             bool reverse=?) except *
 * 
 * cpdef MutableFst shortestpath(Fst ifst,             # <<<<<<<<<<<<<<
 *                               float delta=?,
 *                               int32_t nshortest=?,
 */
struct __pyx_opt_args_10_pywrapfst_shortestpath {
  int __pyx_n;
  float delta;
  int32_t nshortest;
  int64_t nstate;
  PyObject *queue_type;
  bool unique;
  PyObject *weight;
};

/* "cpynini.pxd":38
 * 
 * 
 * ctypedef pair[int64_t, const FstClass *] LabelFstClassPair             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef std::pair<int64_t,fst::script::FstClass const *>  __pyx_t_7cpynini_LabelFstClassPair;
struct __pyx_opt_args_7_pynini_3Fst_paths;
struct __pyx_opt_args_7_pynini_3Fst_string;
struct __pyx_opt_args_7_pynini_3Fst__optimize;
struct __pyx_opt_args_7_pynini__compile_or_copy_Fst;
struct __pyx_opt_args_7_pynini_accep;
struct __pyx_opt_args_7_pynini_cdrewrite;
struct __pyx_opt_args_7_pynini_leniently_compose;
struct __pyx_opt_args_7_pynini_string_file;
struct __pyx_opt_args_7_pynini_string_map;
struct __pyx_opt_args_7_pynini_replace;
struct __pyx_opt_args_7_pynini__pdt_replace;
struct __pyx_opt_args_7_pynini_pdt_shortestpath;
struct __pyx_opt_args_7_pynini_mpdt_compose;
struct __pyx_opt_args_7_pynini_mpdt_expand;

/* "_pynini.pyx":424
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,             # <<<<<<<<<<<<<<
 *                                   output_token_type=None):
 *     """
 */
struct __pyx_opt_args_7_pynini_3Fst_paths {
  int __pyx_n;
  PyObject *input_token_type;
  PyObject *output_token_type;
};

/* "_pynini.pyx":462
 *     return _StringPathIterator(self, input_token_type, output_token_type)
 * 
 *   cpdef string string(self, token_type=None) except *:             # <<<<<<<<<<<<<<
 *     """
 *     string(self, token_type=None)
 */
struct __pyx_opt_args_7_pynini_3Fst_string {
  int __pyx_n;
  PyObject *token_type;
};

/* "_pynini.pyx":635
 *     return super().concat(_fst2)
 * 
 *   cdef void _optimize(self, bool compute_props=False) except *:             # <<<<<<<<<<<<<<
 *     Optimize(self._mfst.get(), compute_props)
 *     self._check_mutating_imethod()
 */
struct __pyx_opt_args_7_pynini_3Fst__optimize {
  int __pyx_n;
  bool compute_props;
};

/* "_pynini.pyx":756
 * 
 * 
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):             # <<<<<<<<<<<<<<
 *   if not isinstance(arg, Fst):
 *     return accep(arg, arc_type=arc_type)
 */
struct __pyx_opt_args_7_pynini__compile_or_copy_Fst {
  int __pyx_n;
  PyObject *arc_type;
};

/* "_pynini.pyx":836
 * 
 * 
 * cpdef Fst accep(astring, weight=None, arc_type="standard", token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   accep(astring, weight=None, arc_type=None, token_type=None)
 */
struct __pyx_opt_args_7_pynini_accep {
  int __pyx_n;
  PyObject *weight;
  PyObject *arc_type;
  PyObject *token_type;
};

/* "_pynini.pyx":926
 * 
 * 
 * cpdef Fst cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl"):             # <<<<<<<<<<<<<<
 *   """
 *   cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl")
 */
struct __pyx_opt_args_7_pynini_cdrewrite {
  int __pyx_n;
  PyObject *direction;
  PyObject *mode;
};

/* "_pynini.pyx":986
 * 
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",             # <<<<<<<<<<<<<<
 *                             bool connect=True):
 *   """
 */
struct __pyx_opt_args_7_pynini_leniently_compose {
  int __pyx_n;
  PyObject *compose_filter;
  bool connect;
};

/* "_pynini.pyx":1033
 * 
 * 
 * cpdef Fst string_file(filename,             # <<<<<<<<<<<<<<
 *                       arc_type="standard",
 *                       input_token_type=None,
 */
struct __pyx_opt_args_7_pynini_string_file {
  int __pyx_n;
  PyObject *arc_type;
  PyObject *input_token_type;
  PyObject *output_token_type;
};

/* "_pynini.pyx":1113
 * 
 * 
 * cpdef Fst string_map(lines,             # <<<<<<<<<<<<<<
 *                      arc_type="standard",
 *                      input_token_type=None,
 */
struct __pyx_opt_args_7_pynini_string_map {
  int __pyx_n;
  PyObject *arc_type;
  PyObject *input_token_type;
  PyObject *output_token_type;
};

/* "_pynini.pyx":1333
 * 
 * 
 * cpdef Fst replace(pairs,             # <<<<<<<<<<<<<<
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 */
struct __pyx_opt_args_7_pynini_replace {
  int __pyx_n;
  PyObject *call_arc_labeling;
  PyObject *return_arc_labeling;
  bool epsilon_on_replace;
  int64_t return_label;
};

/* "_pynini.pyx":1604
 * 
 * 
 * cdef object _pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                          pdt_parser_type="left",
 *                          int64_t start_paren_labels=kNoLabel,
 */
struct __pyx_opt_args_7_pynini__pdt_replace {
  int __pyx_n;
  PyObject *pdt_parser_type;
  int64_t start_paren_labels;
  PyObject *left_paren_prefix;
  PyObject *right_paren_prefix;
};

/* "_pynini.pyx":1704
 * 
 * 
 * cpdef pdt_shortestpath(fst,             # <<<<<<<<<<<<<<
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 */
struct __pyx_opt_args_7_pynini_pdt_shortestpath {
  int __pyx_n;
  PyObject *queue_type;
  bool keep_parentheses;
  bool path_gc;
};

/* "_pynini.pyx":1858
 * 
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,             # <<<<<<<<<<<<<<
 *                        compose_filter="paren", bool left_mpdt=True):
 *   """
 */
struct __pyx_opt_args_7_pynini_mpdt_compose {
  int __pyx_n;
  PyObject *compose_filter;
  bool left_mpdt;
};

/* "_pynini.pyx":1908
 * 
 * 
 * cpdef Fst mpdt_expand(fst,             # <<<<<<<<<<<<<<
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 */
struct __pyx_opt_args_7_pynini_mpdt_expand {
  int __pyx_n;
  bool connect;
  bool keep_parentheses;
};

/* "_pywrapfst.pxd":72
 * 
 * 
 * cdef class Weight:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.WeightClass] _weight
 */
struct __pyx_obj_10_pywrapfst_Weight {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_Weight *__pyx_vtab;
  std::unique_ptr<fst::script::WeightClass>  _weight;
};


/* "_pywrapfst.pxd":108
 * 
 * 
 * cdef class SymbolTableView:             # <<<<<<<<<<<<<<
 * 
 *   cdef const fst.SymbolTable *_raw(self)
 */
struct __pyx_obj_10_pywrapfst_SymbolTableView {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *__pyx_vtab;
};


/* "_pywrapfst.pxd":139
 * 
 * 
 * cdef class _EncodeMapperSymbolTableView(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */
struct __pyx_obj_10_pywrapfst__EncodeMapperSymbolTableView {
  struct __pyx_obj_10_pywrapfst_SymbolTableView __pyx_base;
  bool _input_side;
  std::shared_ptr<fst::script::EncodeMapperClass>  _mapper;
};


/* "_pywrapfst.pxd":147
 * 
 * 
 * cdef class _FstSymbolTableView(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */
struct __pyx_obj_10_pywrapfst__FstSymbolTableView {
  struct __pyx_obj_10_pywrapfst_SymbolTableView __pyx_base;
  bool _input_side;
  std::shared_ptr<fst::script::FstClass>  _fst;
};


/* "_pywrapfst.pxd":155
 * 
 * 
 * cdef class _MutableSymbolTable(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   cdef fst.SymbolTable *_mutable_raw(self)
 */
struct __pyx_obj_10_pywrapfst__MutableSymbolTable {
  struct __pyx_obj_10_pywrapfst_SymbolTableView __pyx_base;
};


/* "_pywrapfst.pxd":168
 * 
 * 
 * cdef class _MutableFstSymbolTableView(_MutableSymbolTable):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */
struct __pyx_obj_10_pywrapfst__MutableFstSymbolTableView {
  struct __pyx_obj_10_pywrapfst__MutableSymbolTable __pyx_base;
  bool _input_side;
  std::shared_ptr<fst::script::MutableFstClass>  _mfst;
};


/* "_pywrapfst.pxd":176
 * 
 * 
 * cdef class SymbolTable(_MutableSymbolTable):             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.SymbolTable] _smart_table
 */
struct __pyx_obj_10_pywrapfst_SymbolTable {
  struct __pyx_obj_10_pywrapfst__MutableSymbolTable __pyx_base;
  std::unique_ptr<fst::SymbolTable>  _smart_table;
};


/* "_pywrapfst.pxd":199
 * 
 * 
 * cdef class _SymbolTableIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef SymbolTableView _table
 */
struct __pyx_obj_10_pywrapfst__SymbolTableIterator {
  PyObject_HEAD
  struct __pyx_obj_10_pywrapfst_SymbolTableView *_table;
  std::unique_ptr<fst::SymbolTable::iterator>  _siter;
};


/* "_pywrapfst.pxd":211
 * 
 * 
 * cdef class EncodeMapper:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.EncodeMapperClass] _mapper
 */
struct __pyx_obj_10_pywrapfst_EncodeMapper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_EncodeMapper *__pyx_vtab;
  std::shared_ptr<fst::script::EncodeMapperClass>  _mapper;
};


/* "_pywrapfst.pxd":248
 * 
 * 
 * cdef class Fst:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */
struct __pyx_obj_10_pywrapfst_Fst {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_Fst *__pyx_vtab;
  std::shared_ptr<fst::script::FstClass>  _fst;
};


/* "_pywrapfst.pxd":314
 * 
 * 
 * cdef class MutableFst(Fst):             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.MutableFstClass] _mfst
 */
struct __pyx_obj_10_pywrapfst_MutableFst {
  struct __pyx_obj_10_pywrapfst_Fst __pyx_base;
  std::shared_ptr<fst::script::MutableFstClass>  _mfst;
};


/* "_pywrapfst.pxd":395
 * 
 * 
 * cdef class VectorFst(MutableFst):             # <<<<<<<<<<<<<<
 * 
 *     pass
 */
struct __pyx_obj_10_pywrapfst_VectorFst {
  struct __pyx_obj_10_pywrapfst_MutableFst __pyx_base;
};


/* "_pywrapfst.pxd":417
 * 
 * 
 * cdef class Arc:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.ArcClass] _arc
 */
struct __pyx_obj_10_pywrapfst_Arc {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_Arc *__pyx_vtab;
  std::unique_ptr<fst::script::ArcClass>  _arc;
};


/* "_pywrapfst.pxd":427
 * 
 * 
 * cdef class _ArcIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */
struct __pyx_obj_10_pywrapfst__ArcIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst__ArcIterator *__pyx_vtab;
  std::shared_ptr<fst::script::FstClass>  _fst;
  std::unique_ptr<fst::script::ArcIteratorClass>  _aiter;
};


/* "_pywrapfst.pxd":449
 * 
 * 
 * cdef class _MutableArcIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.MutableFstClass] _mfst
 */
struct __pyx_obj_10_pywrapfst__MutableArcIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst__MutableArcIterator *__pyx_vtab;
  std::shared_ptr<fst::script::MutableFstClass>  _mfst;
  std::unique_ptr<fst::script::MutableArcIteratorClass>  _aiter;
};


/* "_pywrapfst.pxd":473
 * 
 * 
 * cdef class _StateIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */
struct __pyx_obj_10_pywrapfst__StateIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst__StateIterator *__pyx_vtab;
  std::shared_ptr<fst::script::FstClass>  _fst;
  std::unique_ptr<fst::script::StateIteratorClass>  _siter;
};


/* "_pywrapfst.pxd":595
 * 
 * 
 * cdef class Compiler:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[stringstream] _sstrm
 */
struct __pyx_obj_10_pywrapfst_Compiler {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_Compiler *__pyx_vtab;
  std::unique_ptr<std::stringstream>  _sstrm;
  std::string _fst_type;
  std::string _arc_type;
  fst::SymbolTable const *_isymbols;
  fst::SymbolTable const *_osymbols;
  fst::SymbolTable const *_ssymbols;
  bool _acceptor;
  bool _keep_isymbols;
  bool _keep_osymbols;
  bool _keep_state_numbering;
  bool _allow_negative_labels;
};


/* "_pywrapfst.pxd":616
 * # FarReader.
 * 
 * cdef class FarReader:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.FarReaderClass] _reader
 */
struct __pyx_obj_10_pywrapfst_FarReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_FarReader *__pyx_vtab;
  std::unique_ptr<fst::script::FarReaderClass>  _reader;
};


/* "_pywrapfst.pxd":641
 * # FarWriter.
 * 
 * cdef class FarWriter:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.FarWriterClass] _writer
 */
struct __pyx_obj_10_pywrapfst_FarWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_10_pywrapfst_FarWriter *__pyx_vtab;
  std::unique_ptr<fst::script::FarWriterClass>  _writer;
};


/* "_pynini.pyx":332
 * 
 * 
 * cdef class Fst(_VectorFst):             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini_Fst {
  struct __pyx_obj_10_pywrapfst_VectorFst __pyx_base;
};


/* "_pynini.pyx":1189
 * 
 * 
 * cdef class _PointerSymbolTableView(_SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini__PointerSymbolTableView {
  struct __pyx_obj_10_pywrapfst_SymbolTableView __pyx_base;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr _symbols;
};


/* "_pynini.pyx":1409
 * 
 * 
 * cdef class PdtParentheses:             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini_PdtParentheses {
  PyObject_HEAD
  struct __pyx_vtabstruct_7_pynini_PdtParentheses *__pyx_vtab;
  std::vector<std::pair<int64_t,int64_t> >  _parens;
};


/* "_pynini.pyx":1751
 * 
 * 
 * cdef class MPdtParentheses:             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini_MPdtParentheses {
  PyObject_HEAD
  struct __pyx_vtabstruct_7_pynini_MPdtParentheses *__pyx_vtab;
  std::vector<std::pair<int64_t,int64_t> >  _parens;
  std::vector<int64_t>  _assign;
};


/* "_pynini.pyx":1983
 * 
 * 
 * cdef class _StringPathIterator:             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini__StringPathIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_7_pynini__StringPathIterator *__pyx_vtab;
  std::unique_ptr<fst::script::StringPathIteratorClass>  _paths;
};


/* "_pynini.pyx":2218
 * 
 * 
 * cdef class Far:             # <<<<<<<<<<<<<<
 * 
 *   """
 */
struct __pyx_obj_7_pynini_Far {
  PyObject_HEAD
  struct __pyx_vtabstruct_7_pynini_Far *__pyx_vtab;
  char _mode;
  std::string _name;
  struct __pyx_obj_10_pywrapfst_FarReader *_reader;
  struct __pyx_obj_10_pywrapfst_FarWriter *_writer;
};


/* "_pynini.pyx":680
 *     return self
 * 
 *   def union(self, *fsts2):             # <<<<<<<<<<<<<<
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))
 */
struct __pyx_obj_7_pynini___pyx_scope_struct__union {
  PyObject_HEAD
  PyObject *__pyx_v_fsts2;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_self;
};


/* "_pynini.pyx":681
 * 
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *                            for fst2 in fsts2))
 * 
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7_pynini___pyx_scope_struct__union *__pyx_outer_scope;
  PyObject *__pyx_v_fst2;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};


/* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};


/* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};


/* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};


/* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};


/* "_pynini.pyx":1433
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ {
  PyObject_HEAD
  size_t __pyx_v__i;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_0;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_1;
  size_t __pyx_t_2;
};


/* "_pynini.pyx":1777
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ {
  PyObject_HEAD
  size_t __pyx_v__i;
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_0;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_1;
  size_t __pyx_t_2;
};


/* "_pynini.pyx":2109
 *     return self._paths.get().IString()
 * 
 *   def istrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     istrings(self)
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings {
  PyObject_HEAD
  struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self;
};


/* "_pynini.pyx":2125
 *       self._paths.get().Next()
 * 
 *   def items(self):             # <<<<<<<<<<<<<<
 *      """
 *      items(self)
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_10_items {
  PyObject_HEAD
  struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self;
};


/* "_pynini.pyx":2169
 *     return self._paths.get().OString()
 * 
 *   def ostrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     ostrings(self)
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings {
  PyObject_HEAD
  struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self;
};


/* "_pynini.pyx":2198
 *     return weight
 * 
 *   def weights(self):             # <<<<<<<<<<<<<<
 *     """
 *     weights(self)
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights {
  PyObject_HEAD
  struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self;
};


/* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */
struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch {
  PyObject_HEAD
  PyObject *__pyx_v_fnc;
};



/* "_pywrapfst.pxd":72
 * 
 * 
 * cdef class Weight:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.WeightClass] _weight
 */

struct __pyx_vtabstruct_10_pywrapfst_Weight {
  void (*_check_weight)(struct __pyx_obj_10_pywrapfst_Weight *);
  struct __pyx_obj_10_pywrapfst_Weight *(*copy)(struct __pyx_obj_10_pywrapfst_Weight *, int __pyx_skip_dispatch);
  std::string (*to_string)(struct __pyx_obj_10_pywrapfst_Weight *, int __pyx_skip_dispatch);
  std::string (*type)(struct __pyx_obj_10_pywrapfst_Weight *, int __pyx_skip_dispatch);
  bool (*member)(struct __pyx_obj_10_pywrapfst_Weight *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_Weight *__pyx_vtabptr_10_pywrapfst_Weight;


/* "_pywrapfst.pxd":108
 * 
 * 
 * cdef class SymbolTableView:             # <<<<<<<<<<<<<<
 * 
 *   cdef const fst.SymbolTable *_raw(self)
 */

struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView {
  fst::SymbolTable const *(*_raw)(struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  void (*_raise_nonexistent)(struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  fst::SymbolTable const *(*_raw_ptr_or_raise)(struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  int64_t (*available_key)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  PyObject *(*checksum)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst_SymbolTable *(*copy)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  int64_t (*get_nth_key)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, Py_ssize_t, int __pyx_skip_dispatch);
  PyObject *(*labeled_checksum)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  bool (*member)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, PyObject *, int __pyx_skip_dispatch);
  std::string (*name)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  size_t (*num_symbols)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, PyObject *, int __pyx_skip_dispatch);
  void (*write_text)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*write_to_string)(struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *__pyx_vtabptr_10_pywrapfst_SymbolTableView;


/* "_pywrapfst.pxd":139
 * 
 * 
 * cdef class _EncodeMapperSymbolTableView(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */

struct __pyx_vtabstruct_10_pywrapfst__EncodeMapperSymbolTableView {
  struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView __pyx_base;
};
static struct __pyx_vtabstruct_10_pywrapfst__EncodeMapperSymbolTableView *__pyx_vtabptr_10_pywrapfst__EncodeMapperSymbolTableView;


/* "_pywrapfst.pxd":147
 * 
 * 
 * cdef class _FstSymbolTableView(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */

struct __pyx_vtabstruct_10_pywrapfst__FstSymbolTableView {
  struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView __pyx_base;
};
static struct __pyx_vtabstruct_10_pywrapfst__FstSymbolTableView *__pyx_vtabptr_10_pywrapfst__FstSymbolTableView;


/* "_pywrapfst.pxd":155
 * 
 * 
 * cdef class _MutableSymbolTable(SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   cdef fst.SymbolTable *_mutable_raw(self)
 */

struct __pyx_vtabstruct_10_pywrapfst__MutableSymbolTable {
  struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView __pyx_base;
  fst::SymbolTable *(*_mutable_raw)(struct __pyx_obj_10_pywrapfst__MutableSymbolTable *);
  fst::SymbolTable *(*_mutable_raw_ptr_or_raise)(struct __pyx_obj_10_pywrapfst__MutableSymbolTable *);
  int64_t (*add_symbol)(struct __pyx_obj_10_pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_19_MutableSymbolTable_add_symbol *__pyx_optional_args);
  void (*add_table)(struct __pyx_obj_10_pywrapfst__MutableSymbolTable *, struct __pyx_obj_10_pywrapfst_SymbolTableView *, int __pyx_skip_dispatch);
  void (*set_name)(struct __pyx_obj_10_pywrapfst__MutableSymbolTable *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst__MutableSymbolTable *__pyx_vtabptr_10_pywrapfst__MutableSymbolTable;


/* "_pywrapfst.pxd":168
 * 
 * 
 * cdef class _MutableFstSymbolTableView(_MutableSymbolTable):             # <<<<<<<<<<<<<<
 * 
 *   # Indicates whether this view is of an input or output SymbolTable
 */

struct __pyx_vtabstruct_10_pywrapfst__MutableFstSymbolTableView {
  struct __pyx_vtabstruct_10_pywrapfst__MutableSymbolTable __pyx_base;
};
static struct __pyx_vtabstruct_10_pywrapfst__MutableFstSymbolTableView *__pyx_vtabptr_10_pywrapfst__MutableFstSymbolTableView;


/* "_pywrapfst.pxd":176
 * 
 * 
 * cdef class SymbolTable(_MutableSymbolTable):             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.SymbolTable] _smart_table
 */

struct __pyx_vtabstruct_10_pywrapfst_SymbolTable {
  struct __pyx_vtabstruct_10_pywrapfst__MutableSymbolTable __pyx_base;
};
static struct __pyx_vtabstruct_10_pywrapfst_SymbolTable *__pyx_vtabptr_10_pywrapfst_SymbolTable;


/* "_pywrapfst.pxd":211
 * 
 * 
 * cdef class EncodeMapper:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.EncodeMapperClass] _mapper
 */

struct __pyx_vtabstruct_10_pywrapfst_EncodeMapper {
  std::string (*arc_type)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  std::string (*weight_type)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  uint8_t (*flags)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*write_to_string)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__EncodeMapperSymbolTableView *(*input_symbols)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__EncodeMapperSymbolTableView *(*output_symbols)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, int __pyx_skip_dispatch);
  void (*_set_input_symbols)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  void (*_set_output_symbols)(struct __pyx_obj_10_pywrapfst_EncodeMapper *, struct __pyx_obj_10_pywrapfst_SymbolTableView *);
};
static struct __pyx_vtabstruct_10_pywrapfst_EncodeMapper *__pyx_vtabptr_10_pywrapfst_EncodeMapper;


/* "_pywrapfst.pxd":248
 * 
 * 
 * cdef class Fst:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */

struct __pyx_vtabstruct_10_pywrapfst_Fst {
  std::string (*_local_render_svg)(std::string const &);
  std::string (*arc_type)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__ArcIterator *(*arcs)(struct __pyx_obj_10_pywrapfst_Fst *, int64_t, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst_Fst *(*copy)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  void (*draw)(struct __pyx_obj_10_pywrapfst_Fst *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_3Fst_draw *__pyx_optional_args);
  struct __pyx_obj_10_pywrapfst_Weight *(*final)(struct __pyx_obj_10_pywrapfst_Fst *, int64_t, int __pyx_skip_dispatch);
  std::string (*fst_type)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__FstSymbolTableView *(*input_symbols)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  size_t (*num_arcs)(struct __pyx_obj_10_pywrapfst_Fst *, int64_t, int __pyx_skip_dispatch);
  size_t (*num_input_epsilons)(struct __pyx_obj_10_pywrapfst_Fst *, int64_t, int __pyx_skip_dispatch);
  size_t (*num_output_epsilons)(struct __pyx_obj_10_pywrapfst_Fst *, int64_t, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__FstSymbolTableView *(*output_symbols)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  std::string (*print)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_3Fst_print *__pyx_optional_args);
  int64_t (*start)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst__StateIterator *(*states)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  bool (*verify)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  std::string (*weight_type)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_10_pywrapfst_Fst *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*write_to_string)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_Fst *__pyx_vtabptr_10_pywrapfst_Fst;


/* "_pywrapfst.pxd":314
 * 
 * 
 * cdef class MutableFst(Fst):             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.MutableFstClass] _mfst
 */

struct __pyx_vtabstruct_10_pywrapfst_MutableFst {
  struct __pyx_vtabstruct_10_pywrapfst_Fst __pyx_base;
  void (*_check_mutating_imethod)(struct __pyx_obj_10_pywrapfst_MutableFst *);
  void (*_add_arc)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t, struct __pyx_obj_10_pywrapfst_Arc *);
  int64_t (*add_state)(struct __pyx_obj_10_pywrapfst_MutableFst *, int __pyx_skip_dispatch);
  void (*add_states)(struct __pyx_obj_10_pywrapfst_MutableFst *, size_t, int __pyx_skip_dispatch);
  void (*_arcsort)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__arcsort *__pyx_optional_args);
  void (*_closure)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__closure *__pyx_optional_args);
  void (*_concat)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_obj_10_pywrapfst_Fst *);
  void (*_connect)(struct __pyx_obj_10_pywrapfst_MutableFst *);
  void (*_decode)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_obj_10_pywrapfst_EncodeMapper *);
  void (*_delete_arcs)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t, struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_arcs *__pyx_optional_args);
  void (*_delete_states)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__delete_states *__pyx_optional_args);
  void (*_encode)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_obj_10_pywrapfst_EncodeMapper *);
  void (*_invert)(struct __pyx_obj_10_pywrapfst_MutableFst *);
  void (*_minimize)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__minimize *__pyx_optional_args);
  struct __pyx_obj_10_pywrapfst__MutableArcIterator *(*mutable_arcs)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t, int __pyx_skip_dispatch);
  int64_t (*num_states)(struct __pyx_obj_10_pywrapfst_MutableFst *, int __pyx_skip_dispatch);
  void (*_project)(struct __pyx_obj_10_pywrapfst_MutableFst *, PyObject *);
  void (*_prune)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__prune *__pyx_optional_args);
  void (*_push)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__push *__pyx_optional_args);
  void (*_relabel_pairs)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_pairs *__pyx_optional_args);
  void (*_relabel_tables)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__relabel_tables *__pyx_optional_args);
  void (*_reserve_arcs)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t, size_t);
  void (*_reserve_states)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t);
  void (*_reweight)(struct __pyx_obj_10_pywrapfst_MutableFst *, PyObject *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__reweight *__pyx_optional_args);
  void (*_rmepsilon)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_opt_args_10_pywrapfst_10MutableFst__rmepsilon *__pyx_optional_args);
  void (*_set_final)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t, struct __pyx_opt_args_10_pywrapfst_10MutableFst__set_final *__pyx_optional_args);
  void (*_set_start)(struct __pyx_obj_10_pywrapfst_MutableFst *, int64_t);
  void (*_set_input_symbols)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  void (*_set_output_symbols)(struct __pyx_obj_10_pywrapfst_MutableFst *, struct __pyx_obj_10_pywrapfst_SymbolTableView *);
  void (*_topsort)(struct __pyx_obj_10_pywrapfst_MutableFst *);
};
static struct __pyx_vtabstruct_10_pywrapfst_MutableFst *__pyx_vtabptr_10_pywrapfst_MutableFst;


/* "_pywrapfst.pxd":395
 * 
 * 
 * cdef class VectorFst(MutableFst):             # <<<<<<<<<<<<<<
 * 
 *     pass
 */

struct __pyx_vtabstruct_10_pywrapfst_VectorFst {
  struct __pyx_vtabstruct_10_pywrapfst_MutableFst __pyx_base;
};
static struct __pyx_vtabstruct_10_pywrapfst_VectorFst *__pyx_vtabptr_10_pywrapfst_VectorFst;


/* "_pywrapfst.pxd":417
 * 
 * 
 * cdef class Arc:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.ArcClass] _arc
 */

struct __pyx_vtabstruct_10_pywrapfst_Arc {
  struct __pyx_obj_10_pywrapfst_Arc *(*copy)(struct __pyx_obj_10_pywrapfst_Arc *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_Arc *__pyx_vtabptr_10_pywrapfst_Arc;


/* "_pywrapfst.pxd":427
 * 
 * 
 * cdef class _ArcIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */

struct __pyx_vtabstruct_10_pywrapfst__ArcIterator {
  bool (*done)(struct __pyx_obj_10_pywrapfst__ArcIterator *, int __pyx_skip_dispatch);
  uint8_t (*flags)(struct __pyx_obj_10_pywrapfst__ArcIterator *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_10_pywrapfst__ArcIterator *, int __pyx_skip_dispatch);
  size_t (*position)(struct __pyx_obj_10_pywrapfst__ArcIterator *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_10_pywrapfst__ArcIterator *, int __pyx_skip_dispatch);
  void (*seek)(struct __pyx_obj_10_pywrapfst__ArcIterator *, size_t, int __pyx_skip_dispatch);
  void (*set_flags)(struct __pyx_obj_10_pywrapfst__ArcIterator *, uint8_t, uint8_t, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst_Arc *(*_value)(struct __pyx_obj_10_pywrapfst__ArcIterator *);
};
static struct __pyx_vtabstruct_10_pywrapfst__ArcIterator *__pyx_vtabptr_10_pywrapfst__ArcIterator;


/* "_pywrapfst.pxd":449
 * 
 * 
 * cdef class _MutableArcIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.MutableFstClass] _mfst
 */

struct __pyx_vtabstruct_10_pywrapfst__MutableArcIterator {
  bool (*done)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, int __pyx_skip_dispatch);
  uint8_t (*flags)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, int __pyx_skip_dispatch);
  size_t (*position)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, int __pyx_skip_dispatch);
  void (*seek)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, size_t, int __pyx_skip_dispatch);
  void (*set_flags)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, uint8_t, uint8_t, int __pyx_skip_dispatch);
  void (*_set_value)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *, struct __pyx_obj_10_pywrapfst_Arc *);
  struct __pyx_obj_10_pywrapfst_Arc *(*_value)(struct __pyx_obj_10_pywrapfst__MutableArcIterator *);
};
static struct __pyx_vtabstruct_10_pywrapfst__MutableArcIterator *__pyx_vtabptr_10_pywrapfst__MutableArcIterator;


/* "_pywrapfst.pxd":473
 * 
 * 
 * cdef class _StateIterator:             # <<<<<<<<<<<<<<
 * 
 *   cdef shared_ptr[fst.FstClass] _fst
 */

struct __pyx_vtabstruct_10_pywrapfst__StateIterator {
  bool (*done)(struct __pyx_obj_10_pywrapfst__StateIterator *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_10_pywrapfst__StateIterator *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_10_pywrapfst__StateIterator *, int __pyx_skip_dispatch);
  int64_t (*_value)(struct __pyx_obj_10_pywrapfst__StateIterator *);
  int64_t (*value)(struct __pyx_obj_10_pywrapfst__StateIterator *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst__StateIterator *__pyx_vtabptr_10_pywrapfst__StateIterator;


/* "_pywrapfst.pxd":595
 * 
 * 
 * cdef class Compiler:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[stringstream] _sstrm
 */

struct __pyx_vtabstruct_10_pywrapfst_Compiler {
  struct __pyx_obj_10_pywrapfst_Fst *(*compile)(struct __pyx_obj_10_pywrapfst_Compiler *, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_10_pywrapfst_Compiler *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_Compiler *__pyx_vtabptr_10_pywrapfst_Compiler;


/* "_pywrapfst.pxd":616
 * # FarReader.
 * 
 * cdef class FarReader:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.FarReaderClass] _reader
 */

struct __pyx_vtabstruct_10_pywrapfst_FarReader {
  std::string (*arc_type)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  bool (*done)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  bool (*error)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  std::string (*far_type)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  bool (*find)(struct __pyx_obj_10_pywrapfst_FarReader *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst_Fst *(*get_fst)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  std::string (*get_key)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_10_pywrapfst_FarReader *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_FarReader *__pyx_vtabptr_10_pywrapfst_FarReader;


/* "_pywrapfst.pxd":641
 * # FarWriter.
 * 
 * cdef class FarWriter:             # <<<<<<<<<<<<<<
 * 
 *   cdef unique_ptr[fst.FarWriterClass] _writer
 */

struct __pyx_vtabstruct_10_pywrapfst_FarWriter {
  std::string (*arc_type)(struct __pyx_obj_10_pywrapfst_FarWriter *, int __pyx_skip_dispatch);
  void (*close)(struct __pyx_obj_10_pywrapfst_FarWriter *);
  void (*add)(struct __pyx_obj_10_pywrapfst_FarWriter *, PyObject *, struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch);
  bool (*error)(struct __pyx_obj_10_pywrapfst_FarWriter *, int __pyx_skip_dispatch);
  std::string (*far_type)(struct __pyx_obj_10_pywrapfst_FarWriter *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_10_pywrapfst_FarWriter *__pyx_vtabptr_10_pywrapfst_FarWriter;


/* "_pynini.pyx":332
 * 
 * 
 * cdef class Fst(_VectorFst):             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini_Fst {
  struct __pyx_vtabstruct_10_pywrapfst_VectorFst __pyx_base;
  void (*_from_MutableFstClass)(struct __pyx_obj_7_pynini_Fst *, fst::script::MutableFstClass *);
  struct __pyx_obj_7_pynini__StringPathIterator *(*paths)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_paths *__pyx_optional_args);
  std::string (*string)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_string *__pyx_optional_args);
  struct __pyx_obj_7_pynini_Fst *(*copy)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch);
  void (*_optimize)(struct __pyx_obj_7_pynini_Fst *, struct __pyx_opt_args_7_pynini_3Fst__optimize *__pyx_optional_args);
};
static struct __pyx_vtabstruct_7_pynini_Fst *__pyx_vtabptr_7_pynini_Fst;


/* "_pynini.pyx":1189
 * 
 * 
 * cdef class _PointerSymbolTableView(_SymbolTableView):             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini__PointerSymbolTableView {
  struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView __pyx_base;
};
static struct __pyx_vtabstruct_7_pynini__PointerSymbolTableView *__pyx_vtabptr_7_pynini__PointerSymbolTableView;


/* "_pynini.pyx":1409
 * 
 * 
 * cdef class PdtParentheses:             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini_PdtParentheses {
  struct __pyx_obj_7_pynini_PdtParentheses *(*copy)(struct __pyx_obj_7_pynini_PdtParentheses *, int __pyx_skip_dispatch);
  void (*add_pair)(struct __pyx_obj_7_pynini_PdtParentheses *, int64_t, int64_t, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_7_pynini_PdtParentheses *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7_pynini_PdtParentheses *__pyx_vtabptr_7_pynini_PdtParentheses;


/* "_pynini.pyx":1751
 * 
 * 
 * cdef class MPdtParentheses:             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini_MPdtParentheses {
  struct __pyx_obj_7_pynini_MPdtParentheses *(*copy)(struct __pyx_obj_7_pynini_MPdtParentheses *, int __pyx_skip_dispatch);
  void (*add_triple)(struct __pyx_obj_7_pynini_MPdtParentheses *, int64_t, int64_t, int64_t, int __pyx_skip_dispatch);
  void (*write)(struct __pyx_obj_7_pynini_MPdtParentheses *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7_pynini_MPdtParentheses *__pyx_vtabptr_7_pynini_MPdtParentheses;


/* "_pynini.pyx":1983
 * 
 * 
 * cdef class _StringPathIterator:             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini__StringPathIterator {
  bool (*done)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  bool (*error)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  std::string (*istring)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  std::string (*ostring)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
  struct __pyx_obj_10_pywrapfst_Weight *(*weight)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7_pynini__StringPathIterator *__pyx_vtabptr_7_pynini__StringPathIterator;


/* "_pynini.pyx":2218
 * 
 * 
 * cdef class Far:             # <<<<<<<<<<<<<<
 * 
 *   """
 */

struct __pyx_vtabstruct_7_pynini_Far {
  void (*_check_open)(struct __pyx_obj_7_pynini_Far *);
  void (*_check_mode)(struct __pyx_obj_7_pynini_Far *, char);
  bool (*error)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  std::string (*arc_type)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  bool (*closed)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  std::string (*far_type)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  std::string (*mode)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  std::string (*name)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  bool (*done)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  bool (*find)(struct __pyx_obj_7_pynini_Far *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_7_pynini_Fst *(*get_fst)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  std::string (*get_key)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  void (*next)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  void (*reset)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
  void (*add)(struct __pyx_obj_7_pynini_Far *, PyObject *, struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch);
  void (*close)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7_pynini_Far *__pyx_vtabptr_7_pynini_Far;

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

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

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

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

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

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

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

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

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* tp_new.proto */
#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    return (PyObject*) (((PyTypeObject*)type_obj)->tp_new((PyTypeObject*)type_obj, args, kwargs));
}

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

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

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

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

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

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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

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

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

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

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

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

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

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

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

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

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

/* None.proto */
#include <new>

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

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

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

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

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

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

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

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

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

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

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

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

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

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

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

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

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

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

static void __pyx_f_7_pynini_3Fst__from_MutableFstClass(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, fst::script::MutableFstClass *__pyx_v_tfst); /* proto*/
static struct __pyx_obj_7_pynini__StringPathIterator *__pyx_f_7_pynini_3Fst_paths(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_paths *__pyx_optional_args); /* proto*/
static std::string __pyx_f_7_pynini_3Fst_string(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_string *__pyx_optional_args); /* proto*/
struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Fst_copy(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Fst_copy__pyx_wrap_1(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Fst__optimize(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, struct __pyx_opt_args_7_pynini_3Fst__optimize *__pyx_optional_args); /* proto*/
static __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_f_7_pynini_23_PointerSymbolTableView__raw(struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self); /* proto*/
static struct __pyx_obj_7_pynini_PdtParentheses *__pyx_f_7_pynini_14PdtParentheses_copy(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_14PdtParentheses_add_pair(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_14PdtParentheses_write(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_f_7_pynini_15MPdtParentheses_copy(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_15MPdtParentheses_add_triple(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int64_t __pyx_v_assignment, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_15MPdtParentheses_write(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch); /* proto*/
static bool __pyx_f_7_pynini_19_StringPathIterator_done(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static bool __pyx_f_7_pynini_19_StringPathIterator_error(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_19_StringPathIterator_istring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_19_StringPathIterator_next(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_19_StringPathIterator_reset(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_19_StringPathIterator_ostring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_10_pywrapfst_Weight *__pyx_f_7_pynini_19_StringPathIterator_weight(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Far__check_open(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto*/
static void __pyx_f_7_pynini_3Far__check_mode(struct __pyx_obj_7_pynini_Far *__pyx_v_self, char __pyx_v_mode); /* proto*/
static bool __pyx_f_7_pynini_3Far_error(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_3Far_arc_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static bool __pyx_f_7_pynini_3Far_closed(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_3Far_far_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_3Far_mode(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_3Far_name(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static bool __pyx_f_7_pynini_3Far_done(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static bool __pyx_f_7_pynini_3Far_find(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Far_get_fst(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static std::string __pyx_f_7_pynini_3Far_get_key(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Far_next(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Far_reset(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Far_add(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_7_pynini_3Far_close(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/

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

/* Module declarations from 'libcpp' */

/* Module declarations from 'libcpp.memory' */

/* Module declarations from 'libcpp.utility' */

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

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

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'cmemory' */

/* Module declarations from 'cios' */

/* Module declarations from 'cpywrapfst' */

/* Module declarations from '_pywrapfst' */
static PyTypeObject *__pyx_ptype_10_pywrapfst_Weight = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_SymbolTableView = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__EncodeMapperSymbolTableView = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__FstSymbolTableView = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__MutableSymbolTable = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__MutableFstSymbolTableView = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_SymbolTable = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__SymbolTableIterator = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_EncodeMapper = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_Fst = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_MutableFst = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_VectorFst = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_Arc = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__ArcIterator = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__MutableArcIterator = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst__StateIterator = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_Compiler = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_FarReader = 0;
static PyTypeObject *__pyx_ptype_10_pywrapfst_FarWriter = 0;
static std::string (*__pyx_f_10_pywrapfst_tostring)(PyObject *); /*proto*/
static std::string (*__pyx_f_10_pywrapfst_path_tostring)(PyObject *); /*proto*/
static enum fst::ComposeFilter (*__pyx_f_10_pywrapfst__get_compose_filter)(std::string const &); /*proto*/
static enum fst::QueueType (*__pyx_f_10_pywrapfst__get_queue_type)(std::string const &); /*proto*/
static enum fst::ReplaceLabelType (*__pyx_f_10_pywrapfst__get_replace_label_type)(std::string const &, bool); /*proto*/
static fst::script::WeightClass (*__pyx_f_10_pywrapfst__get_WeightClass_or_one)(std::string const &, PyObject *); /*proto*/
static fst::script::WeightClass (*__pyx_f_10_pywrapfst__get_WeightClass_or_zero)(std::string const &, PyObject *); /*proto*/
static bool (*__pyx_f_10_pywrapfst_equal)(struct __pyx_obj_10_pywrapfst_Fst *, struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_equal *__pyx_optional_args); /*proto*/
static struct __pyx_obj_10_pywrapfst_MutableFst *(*__pyx_f_10_pywrapfst_replace)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_replace *__pyx_optional_args); /*proto*/

/* Module declarations from 'cpynini' */

/* Module declarations from '_pynini' */
static PyTypeObject *__pyx_ptype_7_pynini_Fst = 0;
static PyTypeObject *__pyx_ptype_7_pynini__PointerSymbolTableView = 0;
static PyTypeObject *__pyx_ptype_7_pynini_PdtParentheses = 0;
static PyTypeObject *__pyx_ptype_7_pynini_MPdtParentheses = 0;
static PyTypeObject *__pyx_ptype_7_pynini__StringPathIterator = 0;
static PyTypeObject *__pyx_ptype_7_pynini_Far = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct__union = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_2__1arg_patch = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_3__shortestdistance_patch = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_4__compose_patch = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_5__difference_patch = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_6__comp_patch = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_8___iter__ = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_9_istrings = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_10_items = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_11_ostrings = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_12_weights = 0;
static PyTypeObject *__pyx_ptype_7_pynini___pyx_scope_struct_13__copy_patch = 0;
static fst::TokenType __pyx_f_7_pynini__get_token_type(std::string const &); /*proto*/
static enum fst::CDRewriteDirection __pyx_f_7_pynini__get_cdrewrite_direction(std::string const &); /*proto*/
static enum fst::CDRewriteMode __pyx_f_7_pynini__get_cdrewrite_mode(std::string const &); /*proto*/
static fst::PdtComposeFilter __pyx_f_7_pynini__get_pdt_compose_filter(std::string const &); /*proto*/
static fst::PdtParserType __pyx_f_7_pynini__get_pdt_parser_type(std::string const &); /*proto*/
static void __pyx_f_7_pynini__maybe_arcsort(fst::script::MutableFstClass *, fst::script::MutableFstClass *); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__compile_or_copy_Fst(PyObject *, struct __pyx_opt_args_7_pynini__compile_or_copy_Fst *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_7_pynini__compile_or_copy_two_Fsts(PyObject *, PyObject *); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__init_Fst_from_MutableFst(struct __pyx_obj_10_pywrapfst_MutableFst *); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__from_pywrapfst(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__read(PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__read_from_string(PyObject *, int __pyx_skip_dispatch); /*proto*/
static std::string __pyx_f_7_pynini_escape(PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_accep(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_accep *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_cross(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_cdrewrite(PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_cdrewrite *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_leniently_compose(PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_leniently_compose *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_string_file(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_string_file *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_string_map(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_string_map *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_f_7_pynini_generated_symbols(int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_concat(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_replace(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_replace *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_7_pynini__pdt_replace(PyObject *, struct __pyx_opt_args_7_pynini__pdt_replace *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_pdt_reverse(PyObject *, struct __pyx_obj_7_pynini_PdtParentheses *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_7_pynini_pdt_shortestpath(PyObject *, struct __pyx_obj_7_pynini_PdtParentheses *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_pdt_shortestpath *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_mpdt_compose(PyObject *, PyObject *, struct __pyx_obj_7_pynini_MPdtParentheses *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_mpdt_compose *__pyx_optional_args); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_mpdt_expand(PyObject *, struct __pyx_obj_7_pynini_MPdtParentheses *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_mpdt_expand *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_7_pynini___pyx_unpickle_PdtParentheses__set_state(struct __pyx_obj_7_pynini_PdtParentheses *, PyObject *); /*proto*/
static PyObject *__pyx_f_7_pynini___pyx_unpickle_MPdtParentheses__set_state(struct __pyx_obj_7_pynini_MPdtParentheses *, PyObject *); /*proto*/
static PyObject *__pyx_f_7_pynini___pyx_unpickle_Far__set_state(struct __pyx_obj_7_pynini_Far *, PyObject *); /*proto*/
static PyObject *__pyx_convert_pair_to_py_int64_t____int64_t(std::pair<int64_t,int64_t>  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(const std::vector<std::pair<int64_t,int64_t> >  &); /*proto*/
static std::pair<int64_t,int64_t>  __pyx_convert_pair_from_py_int64_t__and_int64_t(PyObject *); /*proto*/
static std::vector<std::pair<int64_t,int64_t> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_int64_t(const std::vector<int64_t>  &); /*proto*/
static std::vector<int64_t>  __pyx_convert_vector_from_py_int64_t(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "_pynini"
extern int __pyx_module_is_main__pynini;
int __pyx_module_is_main__pynini = 0;

/* Implementation of '_pynini' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_KeyError;
static const char __pyx_k_c[] = "c";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_x[] = "x";
static const char __pyx_k__3[] = ">";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_io[] = "io";
static const char __pyx_k_mu[] = "mu";
static const char __pyx_k_nu[] = "nu";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_tb[] = "tb";
static const char __pyx_k_Arc[] = "Arc";
static const char __pyx_k_Far[] = " Far ";
static const char __pyx_k_Fst[] = "Fst";
static const char __pyx_k__16[] = "<";
static const char __pyx_k__18[] = "(_";
static const char __pyx_k__19[] = ")_";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_exc[] = "exc";
static const char __pyx_k_fnc[] = "fnc";
static const char __pyx_k_fst[] = "fst";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_ltr[] = "ltr";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_not[] = "not ";
static const char __pyx_k_obl[] = "obl";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_tau[] = "tau";
static const char __pyx_k_None[] = "None";
static const char __pyx_k_arg1[] = "arg1";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_auto[] = "auto";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_done[] = "done";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_fifo[] = "fifo";
static const char __pyx_k_find[] = "find";
static const char __pyx_k_fst1[] = "fst1";
static const char __pyx_k_fst2[] = "fst2";
static const char __pyx_k_fsts[] = "fsts";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_left[] = "left";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_opts[] = "_opts";
static const char __pyx_k_plus[] = "plus";
static const char __pyx_k_push[] = "push";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_ERROR[] = "ERROR";
static const char __pyx_k_Far_2[] = "Far";
static const char __pyx_k_accep[] = "accep";
static const char __pyx_k_at_0x[] = " at 0x";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_equal[] = "equal";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_fst_2[] = "_fst";
static const char __pyx_k_fsts2[] = "fsts2";
static const char __pyx_k_input[] = "input";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_label[] = "label";
static const char __pyx_k_lines[] = "lines";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_pairs[] = "pairs";
static const char __pyx_k_paren[] = "paren";
static const char __pyx_k_patch[] = "patch";
static const char __pyx_k_paths[] = "paths";
static const char __pyx_k_power[] = "power";
static const char __pyx_k_prune[] = "prune";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_times[] = "times";
static const char __pyx_k_union[] = "union";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_wraps[] = "wraps";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_CYCLIC[] = "CYCLIC";
static const char __pyx_k_STRING[] = "STRING";
static const char __pyx_k_Weight[] = "Weight";
static const char __pyx_k_arcmap[] = "arcmap";
static const char __pyx_k_closed[] = "closed";
static const char __pyx_k_concat[] = "concat";
static const char __pyx_k_create[] = "create";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_divide[] = "divide";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_fst1_2[] = "_fst1";
static const char __pyx_k_fst2_2[] = "_fst2";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_invert[] = "invert";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_mode_2[] = ", mode '";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "name";
static const char __pyx_k_next_2[] = "__next__";
static const char __pyx_k_parens[] = "parens";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pynini[] = "_pynini";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_string[] = "string";
static const char __pyx_k_typing[] = "typing";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_weight[] = "weight";
static const char __pyx_k_ACYCLIC[] = "ACYCLIC";
static const char __pyx_k_FarType[] = "FarType";
static const char __pyx_k_FstLike[] = "FstLike";
static const char __pyx_k_MUTABLE[] = "MUTABLE";
static const char __pyx_k_arcsort[] = "arcsort";
static const char __pyx_k_astring[] = "astring";
static const char __pyx_k_at_0x_2[] = "' at 0x";
static const char __pyx_k_closure[] = "closure";
static const char __pyx_k_compose[] = "compose";
static const char __pyx_k_connect[] = "connect";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_get_fst[] = "get_fst";
static const char __pyx_k_get_key[] = "get_key";
static const char __pyx_k_istring[] = "istring";
static const char __pyx_k_neither[] = "neither";
static const char __pyx_k_ostring[] = "ostring";
static const char __pyx_k_path_gc[] = "path_gc";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_project[] = "project";
static const char __pyx_k_randgen[] = "randgen";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_symbols[] = "_symbols";
static const char __pyx_k_topsort[] = "topsort";
static const char __pyx_k_weights[] = "weights";
static const char __pyx_k_ACCEPTOR[] = "ACCEPTOR";
static const char __pyx_k_EPSILONS[] = "EPSILONS";
static const char __pyx_k_EXPANDED[] = "EXPANDED";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_NO_LABEL[] = "NO_LABEL";
static const char __pyx_k_SortType[] = "SortType";
static const char __pyx_k_WEIGHTED[] = "WEIGHTED";
static const char __pyx_k_add_pair[] = "add_pair";
static const char __pyx_k_arc_type[] = "arc_type";
static const char __pyx_k_exc_type[] = "exc_type";
static const char __pyx_k_far_type[] = "far_type";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_istrings[] = "istrings";
static const char __pyx_k_left_pdt[] = "left_pdt";
static const char __pyx_k_minimize[] = "minimize";
static const char __pyx_k_optimize[] = "optimize";
static const char __pyx_k_ostrings[] = "ostrings";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_readable[] = "readable";
static const char __pyx_k_reweight[] = "reweight";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_standard[] = "standard";
static const char __pyx_k_statemap[] = "statemap";
static const char __pyx_k_weight_2[] = "_weight";
static const char __pyx_k_writable[] = "writable";
static const char __pyx_k_ARC_FLAGS[] = "ARC_FLAGS";
static const char __pyx_k_NO_SYMBOL[] = "NO_SYMBOL";
static const char __pyx_k_QueueType[] = "QueueType";
static const char __pyx_k_TokenType[] = "TokenType";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_direction[] = "direction";
static const char __pyx_k_exc_value[] = "exc_value";
static const char __pyx_k_functools[] = "functools";
static const char __pyx_k_intersect[] = "intersect";
static const char __pyx_k_left_mpdt[] = "left_mpdt";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_pywrapfst[] = "_pywrapfst";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_rmepsilon[] = "rmepsilon";
static const char __pyx_k_traceback[] = "traceback";
static const char __pyx_k_1arg_patch[] = "_1arg_patch";
static const char __pyx_k_ACCESSIBLE[] = "ACCESSIBLE";
static const char __pyx_k_ArcMapType[] = "ArcMapType";
static const char __pyx_k_FstIOError[] = "FstIOError";
static const char __pyx_k_FstOpError[] = "FstOpError";
static const char __pyx_k_I_EPSILONS[] = "I_EPSILONS";
static const char __pyx_k_NOT_STRING[] = "NOT_STRING";
static const char __pyx_k_O_EPSILONS[] = "O_EPSILONS";
static const char __pyx_k_TOP_SORTED[] = "TOP_SORTED";
static const char __pyx_k_UNWEIGHTED[] = "UNWEIGHTED";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_WeightLike[] = "WeightLike";
static const char __pyx_k_add_triple[] = "add_triple";
static const char __pyx_k_assignment[] = "assignment";
static const char __pyx_k_comp_patch[] = "_comp_patch";
static const char __pyx_k_contextlib[] = "contextlib";
static const char __pyx_k_copy_patch[] = "_copy_patch";
static const char __pyx_k_difference[] = "difference";
static const char __pyx_k_equivalent[] = "equivalent";
static const char __pyx_k_isomorphic[] = "isomorphic";
static const char __pyx_k_pdt_expand[] = "pdt_expand";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_queue_type[] = "queue_type";
static const char __pyx_k_result_fst[] = "result_fst";
static const char __pyx_k_sigma_star[] = "sigma_star";
static const char __pyx_k_token_type[] = "token_type";
static const char __pyx_k_ArcIterator[] = "_ArcIterator";
static const char __pyx_k_FarFileMode[] = "FarFileMode";
static const char __pyx_k_FstArgError[] = "FstArgError";
static const char __pyx_k_NO_EPSILONS[] = "NO_EPSILONS";
static const char __pyx_k_NO_STATE_ID[] = "NO_STATE_ID";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_ProjectType[] = "ProjectType";
static const char __pyx_k_Read_failed[] = "Read failed";
static const char __pyx_k_SymbolTable[] = "SymbolTable";
static const char __pyx_k_determinize[] = "determinize";
static const char __pyx_k_pdt_compose[] = "pdt_compose";
static const char __pyx_k_pdt_replace[] = "pdt_replace";
static const char __pyx_k_synchronize[] = "synchronize";
static const char __pyx_k_ARC_NO_CACHE[] = "ARC_NO_CACHE";
static const char __pyx_k_COACCESSIBLE[] = "COACCESSIBLE";
static const char __pyx_k_ENCODE_FLAGS[] = "ENCODE_FLAGS";
static const char __pyx_k_EncodeMapper[] = "EncodeMapper";
static const char __pyx_k_NOT_ACCEPTOR[] = "NOT_ACCEPTOR";
static const char __pyx_k_ReweightType[] = "ReweightType";
static const char __pyx_k_StateMapType[] = "StateMapType";
static const char __pyx_k_Unknown_mode[] = "Unknown mode: ";
static const char __pyx_k_Write_failed[] = "Write failed: ";
static const char __pyx_k_disambiguate[] = "disambiguate";
static const char __pyx_k_epsnormalize[] = "epsnormalize";
static const char __pyx_k_mpdt_reverse[] = "mpdt_reverse";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_return_label[] = "return_label";
static const char __pyx_k_shortestpath[] = "shortestpath";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_token_type_2[] = "_token_type";
static const char __pyx_k_CDRewriteMode[] = "CDRewriteMode";
static const char __pyx_k_ComposeFilter[] = "ComposeFilter";
static const char __pyx_k_ENCODE_LABELS[] = "ENCODE_LABELS";
static const char __pyx_k_FstIndexError[] = "FstIndexError";
static const char __pyx_k_FstProperties[] = "FstProperties";
static const char __pyx_k_NO_I_EPSILONS[] = "NO_I_EPSILONS";
static const char __pyx_k_NO_O_EPSILONS[] = "NO_O_EPSILONS";
static const char __pyx_k_Read_failed_2[] = "Read failed: ";
static const char __pyx_k_StateIterator[] = "_StateIterator";
static const char __pyx_k_compose_patch[] = "_compose_patch";
static const char __pyx_k_compute_props[] = "compute_props";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_relabel_pairs[] = "relabel_pairs";
static const char __pyx_k_result_parens[] = "result_parens";
static const char __pyx_k_ENCODE_WEIGHTS[] = "ENCODE_WEIGHTS";
static const char __pyx_k_FST_PROPERTIES[] = "FST_PROPERTIES";
static const char __pyx_k_INITIAL_CYCLIC[] = "INITIAL_CYCLIC";
static const char __pyx_k_I_LABEL_SORTED[] = "I_LABEL_SORTED";
static const char __pyx_k_NOT_ACCESSIBLE[] = "NOT_ACCESSIBLE";
static const char __pyx_k_NOT_TOP_SORTED[] = "NOT_TOP_SORTED";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_O_LABEL_SORTED[] = "O_LABEL_SORTED";
static const char __pyx_k_PdtParentheses[] = "PdtParentheses";
static const char __pyx_k_compose_filter[] = "compose_filter";
static const char __pyx_k_from_pywrapfst[] = "from_pywrapfst";
static const char __pyx_k_randequivalent[] = "randequivalent";
static const char __pyx_k_relabel_tables[] = "relabel_tables";
static const char __pyx_k_ARC_VALUE_FLAGS[] = "ARC_VALUE_FLAGS";
static const char __pyx_k_COPY_PROPERTIES[] = "COPY_PROPERTIES";
static const char __pyx_k_DeterminizeType[] = "DeterminizeType";
static const char __pyx_k_INITIAL_ACYCLIC[] = "INITIAL_ACYCLIC";
static const char __pyx_k_I_DETERMINISTIC[] = "I_DETERMINISTIC";
static const char __pyx_k_MPdtParentheses[] = "MPdtParentheses";
static const char __pyx_k_NULL_PROPERTIES[] = "NULL_PROPERTIES";
static const char __pyx_k_O_DETERMINISTIC[] = "O_DETERMINISTIC";
static const char __pyx_k_SymbolTableView[] = "SymbolTableView";
static const char __pyx_k_WEIGHTED_CYCLES[] = "WEIGHTED_CYCLES";
static const char __pyx_k_pdt_parser_type[] = "pdt_parser_type";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_ARC_WEIGHT_VALUE[] = "ARC_WEIGHT_VALUE";
static const char __pyx_k_ContextDecorator[] = "ContextDecorator";
static const char __pyx_k_EpsNormalizeType[] = "EpsNormalizeType";
static const char __pyx_k_NOT_COACCESSIBLE[] = "NOT_COACCESSIBLE";
static const char __pyx_k_Operation_failed[] = "Operation failed";
static const char __pyx_k_RandArcSelection[] = "RandArcSelection";
static const char __pyx_k_ReplaceLabelType[] = "ReplaceLabelType";
static const char __pyx_k_Unknown_arc_type[] = "Unknown arc type: ";
static const char __pyx_k_compose_filter_2[] = "_compose_filter";
static const char __pyx_k_difference_patch[] = "_difference_patch";
static const char __pyx_k_input_token_type[] = "input_token_type";
static const char __pyx_k_keep_parentheses[] = "keep_parentheses";
static const char __pyx_k_pyx_unpickle_Far[] = "__pyx_unpickle_Far";
static const char __pyx_k_read_from_string[] = "_read_from_string";
static const char __pyx_k_shortestdistance[] = "shortestdistance";
static const char __pyx_k_ARC_I_LABEL_VALUE[] = "ARC_I_LABEL_VALUE";
static const char __pyx_k_ARC_O_LABEL_VALUE[] = "ARC_O_LABEL_VALUE";
static const char __pyx_k_BINARY_PROPERTIES[] = "BINARY_PROPERTIES";
static const char __pyx_k_FstBadWeightError[] = "FstBadWeightError";
static const char __pyx_k_UNWEIGHTED_CYCLES[] = "UNWEIGHTED_CYCLES";
static const char __pyx_k_call_arc_labeling[] = "call_arc_labeling";
static const char __pyx_k_left_paren_prefix[] = "left_paren_prefix";
static const char __pyx_k_output_token_type[] = "output_token_type";
static const char __pyx_k_ADD_ARC_PROPERTIES[] = "ADD_ARC_PROPERTIES";
static const char __pyx_k_CDRewriteDirection[] = "CDRewriteDirection";
static const char __pyx_k_MutableArcIterator[] = "_MutableArcIterator";
static const char __pyx_k_NOT_I_LABEL_SORTED[] = "NOT_I_LABEL_SORTED";
static const char __pyx_k_NOT_O_LABEL_SORTED[] = "NOT_O_LABEL_SORTED";
static const char __pyx_k_SET_ARC_PROPERTIES[] = "SET_ARC_PROPERTIES";
static const char __pyx_k_StringPathIterator[] = "_StringPathIterator";
static const char __pyx_k_TRINARY_PROPERTIES[] = "TRINARY_PROPERTIES";
static const char __pyx_k_Unknown_token_type[] = "Unknown token type: ";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_default_token_type[] = "default_token_type";
static const char __pyx_k_epsilon_on_replace[] = "epsilon_on_replace";
static const char __pyx_k_merge_symbol_table[] = "merge_symbol_table";
static const char __pyx_k_read_from_string_2[] = "read_from_string";
static const char __pyx_k_right_paren_prefix[] = "right_paren_prefix";
static const char __pyx_k_start_paren_labels[] = "start_paren_labels";
static const char __pyx_k_typing_Literal_r_w[] = "typing.Literal[\"r\", \"w\"]";
static const char __pyx_k_ARC_SORT_PROPERTIES[] = "ARC_SORT_PROPERTIES";
static const char __pyx_k_NON_I_DETERMINISTIC[] = "NON_I_DETERMINISTIC";
static const char __pyx_k_NON_O_DETERMINISTIC[] = "NON_O_DETERMINISTIC";
static const char __pyx_k_return_arc_labeling[] = "return_arc_labeling";
static const char __pyx_k_ADD_STATE_PROPERTIES[] = "ADD_STATE_PROPERTIES";
static const char __pyx_k_ARC_NEXT_STATE_VALUE[] = "ARC_NEXT_STATE_VALUE";
static const char __pyx_k_EXTRINSIC_PROPERTIES[] = "EXTRINSIC_PROPERTIES";
static const char __pyx_k_INTRINSIC_PROPERTIES[] = "INTRINSIC_PROPERTIES";
static const char __pyx_k_SET_FINAL_PROPERTIES[] = "SET_FINAL_PROPERTIES";
static const char __pyx_k_SET_START_PROPERTIES[] = "SET_START_PROPERTIES";
static const char __pyx_k_UnsupportedOperation[] = "UnsupportedOperation";
static const char __pyx_k_compact_symbol_table[] = "compact_symbol_table";
static const char __pyx_k_typing_Union_Fst_str[] = "typing.Union[Fst, str]";
static const char __pyx_k_union_locals_genexpr[] = "union.<locals>.genexpr";
static const char __pyx_k_DELETE_ARC_PROPERTIES[] = "DELETE_ARC_PROPERTIES";
static const char __pyx_k_PdtParentheses___iter[] = "PdtParentheses.__iter__";
static const char __pyx_k_STATE_SORT_PROPERTIES[] = "STATE_SORT_PROPERTIES";
static const char __pyx_k_MPdtParentheses___iter[] = "MPdtParentheses.__iter__";
static const char __pyx_k_NEG_TRINARY_PROPERTIES[] = "NEG_TRINARY_PROPERTIES";
static const char __pyx_k_POS_TRINARY_PROPERTIES[] = "POS_TRINARY_PROPERTIES";
static const char __pyx_k_PointerSymbolTableView[] = "_PointerSymbolTableView";
static const char __pyx_k_extensions__pynini_pyx[] = "extensions/_pynini.pyx";
static const char __pyx_k_shortestdistance_patch[] = "_shortestdistance_patch";
static const char __pyx_k_typing_Literal_obl_opt[] = "typing.Literal[\"obl\", \"opt\"]";
static const char __pyx_k_1arg_patch_locals_patch[] = "_1arg_patch.<locals>.patch";
static const char __pyx_k_DELETE_STATE_PROPERTIES[] = "DELETE_STATE_PROPERTIES";
static const char __pyx_k_Unknown_PDT_parser_type[] = "Unknown PDT parser type: ";
static const char __pyx_k_comp_patch_locals_patch[] = "_comp_patch.<locals>.patch";
static const char __pyx_k_copy_patch_locals_patch[] = "_copy_patch.<locals>.patch";
static const char __pyx_k_RM_SUPERFINAL_PROPERTIES[] = "RM_SUPERFINAL_PROPERTIES";
static const char __pyx_k_StringPathIterator_items[] = "_StringPathIterator.items";
static const char __pyx_k_ADD_SUPERFINAL_PROPERTIES[] = "ADD_SUPERFINAL_PROPERTIES";
static const char __pyx_k_FstStringCompilationError[] = "FstStringCompilationError";
static const char __pyx_k_String_compilation_failed[] = "String compilation failed";
static const char __pyx_k_default_token_type___exit[] = "default_token_type.__exit__";
static const char __pyx_k_default_token_type___init[] = "default_token_type.__init__";
static const char __pyx_k_StringPathIterator_weights[] = "_StringPathIterator.weights";
static const char __pyx_k_compose_patch_locals_patch[] = "_compose_patch.<locals>.patch";
static const char __pyx_k_default_token_type___enter[] = "default_token_type.__enter__";
static const char __pyx_k_typing_Literal_ltr_rtl_sim[] = "typing.Literal[\"ltr\", \"rtl\", \"sim\"]";
static const char __pyx_k_I_O_operation_on_closed_FAR[] = "I/O operation on closed FAR";
static const char __pyx_k_StringPathIterator_istrings[] = "_StringPathIterator.istrings";
static const char __pyx_k_StringPathIterator_ostrings[] = "_StringPathIterator.ostrings";
static const char __pyx_k_WEIGHT_INVARIANT_PROPERTIES[] = "WEIGHT_INVARIANT_PROPERTIES";
static const char __pyx_k_pyx_unpickle_PdtParentheses[] = "__pyx_unpickle_PdtParentheses";
static const char __pyx_k_Expected_tuple_of_length_two[] = "Expected tuple of length two";
static const char __pyx_k_I_LABEL_INVARIANT_PROPERTIES[] = "I_LABEL_INVARIANT_PROPERTIES";
static const char __pyx_k_O_LABEL_INVARIANT_PROPERTIES[] = "O_LABEL_INVARIANT_PROPERTIES";
static const char __pyx_k_pyx_unpickle_MPdtParentheses[] = "__pyx_unpickle_MPdtParentheses";
static const char __pyx_k_String_map_compilation_failed[] = "String map compilation failed";
static const char __pyx_k_const_pointer_SymbolTableView[] = "<const pointer SymbolTableView ";
static const char __pyx_k_difference_patch_locals_patch[] = "_difference_patch.<locals>.patch";
static const char __pyx_k_Override_the_default_token_type[] = "Override the default token_type used by Pynini functions and classes.\n\n  A context manager and context decorator to temporarily override the default\n  token_type used by Pynini functions and classes.\n\n  Args:\n    token_type: A string indicating how the string is to be constructed from\n        arc labels---one of: \"byte\" (interprets arc labels as raw bytes),\n        \"utf8\" (interprets arc labels as Unicode code points), or a\n        SymbolTable.\n\n  Returns:\n    A context decorator that temporarily overrides the default token_type used\n    by Pynini.\n\n  Raises:\n    FstArgError: Unknown token type.\n  ";
static const char __pyx_k_Unknown_PDT_compose_filter_type[] = "Unknown PDT compose filter type: ";
static const char __pyx_k_self__paths_cannot_be_converted[] = "self._paths cannot be converted to a Python object for pickling";
static const char __pyx_k_shortestdistance_patch_locals_p[] = "_shortestdistance_patch.<locals>.patch";
static const char __pyx_k_Incompatible_checksums_s_vs_0x07[] = "Incompatible checksums (%s vs 0x078cdb7 = (_parens))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x79[] = "Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xcb[] = "Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))";
static const char __pyx_k_Pynini_finite_state_grammar_comp[] = "Pynini: finite-state grammar compilation for Python.";
static const char __pyx_k_The_lower_bound_must_be_an_integ[] = "The lower bound must be an integer";
static const char __pyx_k_Unknown_context_dependent_rewrit[] = "Unknown context-dependent rewrite direction: ";
static const char __pyx_k_self__symbols_cannot_be_converte[] = "self._symbols cannot be converted to a Python object for pickling";
static const char __pyx_k_typing_Union_SymbolTableView_typ[] = "typing.Union[SymbolTableView, typing.Literal[\"byte\", \"utf8\"]]";
static const char __pyx_k_Unknown_context_dependent_rewrit_2[] = "Unknown context-dependent rewrite mode: ";
static PyObject *__pyx_n_s_1arg_patch;
static PyObject *__pyx_n_s_1arg_patch_locals_patch;
static PyObject *__pyx_n_s_ACCEPTOR;
static PyObject *__pyx_n_s_ACCESSIBLE;
static PyObject *__pyx_n_s_ACYCLIC;
static PyObject *__pyx_n_s_ADD_ARC_PROPERTIES;
static PyObject *__pyx_n_s_ADD_STATE_PROPERTIES;
static PyObject *__pyx_n_s_ADD_SUPERFINAL_PROPERTIES;
static PyObject *__pyx_n_s_ARC_FLAGS;
static PyObject *__pyx_n_s_ARC_I_LABEL_VALUE;
static PyObject *__pyx_n_s_ARC_NEXT_STATE_VALUE;
static PyObject *__pyx_n_s_ARC_NO_CACHE;
static PyObject *__pyx_n_s_ARC_O_LABEL_VALUE;
static PyObject *__pyx_n_s_ARC_SORT_PROPERTIES;
static PyObject *__pyx_n_s_ARC_VALUE_FLAGS;
static PyObject *__pyx_n_s_ARC_WEIGHT_VALUE;
static PyObject *__pyx_n_s_Arc;
static PyObject *__pyx_n_s_ArcIterator;
static PyObject *__pyx_n_s_ArcMapType;
static PyObject *__pyx_n_s_BINARY_PROPERTIES;
static PyObject *__pyx_n_s_CDRewriteDirection;
static PyObject *__pyx_n_s_CDRewriteMode;
static PyObject *__pyx_n_s_COACCESSIBLE;
static PyObject *__pyx_n_s_COPY_PROPERTIES;
static PyObject *__pyx_n_s_CYCLIC;
static PyObject *__pyx_n_s_ComposeFilter;
static PyObject *__pyx_n_s_ContextDecorator;
static PyObject *__pyx_n_s_DELETE_ARC_PROPERTIES;
static PyObject *__pyx_n_s_DELETE_STATE_PROPERTIES;
static PyObject *__pyx_n_s_DeterminizeType;
static PyObject *__pyx_n_s_ENCODE_FLAGS;
static PyObject *__pyx_n_s_ENCODE_LABELS;
static PyObject *__pyx_n_s_ENCODE_WEIGHTS;
static PyObject *__pyx_n_s_EPSILONS;
static PyObject *__pyx_n_s_ERROR;
static PyObject *__pyx_n_s_EXPANDED;
static PyObject *__pyx_n_s_EXTRINSIC_PROPERTIES;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_n_s_EncodeMapper;
static PyObject *__pyx_n_s_EpsNormalizeType;
static PyObject *__pyx_kp_u_Expected_tuple_of_length_two;
static PyObject *__pyx_n_s_FST_PROPERTIES;
static PyObject *__pyx_kp_u_Far;
static PyObject *__pyx_n_s_FarFileMode;
static PyObject *__pyx_n_s_FarType;
static PyObject *__pyx_n_s_Far_2;
static PyObject *__pyx_n_s_Fst;
static PyObject *__pyx_n_s_FstArgError;
static PyObject *__pyx_n_s_FstBadWeightError;
static PyObject *__pyx_n_s_FstIOError;
static PyObject *__pyx_n_s_FstIndexError;
static PyObject *__pyx_n_s_FstLike;
static PyObject *__pyx_n_s_FstOpError;
static PyObject *__pyx_n_s_FstProperties;
static PyObject *__pyx_n_s_FstStringCompilationError;
static PyObject *__pyx_n_s_INITIAL_ACYCLIC;
static PyObject *__pyx_n_s_INITIAL_CYCLIC;
static PyObject *__pyx_n_s_INTRINSIC_PROPERTIES;
static PyObject *__pyx_n_s_I_DETERMINISTIC;
static PyObject *__pyx_n_s_I_EPSILONS;
static PyObject *__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES;
static PyObject *__pyx_n_s_I_LABEL_SORTED;
static PyObject *__pyx_kp_u_I_O_operation_on_closed_FAR;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x07;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x79;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xcb;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_MPdtParentheses;
static PyObject *__pyx_n_s_MPdtParentheses___iter;
static PyObject *__pyx_n_s_MUTABLE;
static PyObject *__pyx_n_s_MutableArcIterator;
static PyObject *__pyx_n_s_NEG_TRINARY_PROPERTIES;
static PyObject *__pyx_n_s_NON_I_DETERMINISTIC;
static PyObject *__pyx_n_s_NON_O_DETERMINISTIC;
static PyObject *__pyx_n_s_NOT_ACCEPTOR;
static PyObject *__pyx_n_s_NOT_ACCESSIBLE;
static PyObject *__pyx_n_s_NOT_COACCESSIBLE;
static PyObject *__pyx_n_s_NOT_I_LABEL_SORTED;
static PyObject *__pyx_n_s_NOT_O_LABEL_SORTED;
static PyObject *__pyx_n_s_NOT_STRING;
static PyObject *__pyx_n_s_NOT_TOP_SORTED;
static PyObject *__pyx_n_s_NO_EPSILONS;
static PyObject *__pyx_n_s_NO_I_EPSILONS;
static PyObject *__pyx_n_s_NO_LABEL;
static PyObject *__pyx_n_s_NO_O_EPSILONS;
static PyObject *__pyx_n_s_NO_STATE_ID;
static PyObject *__pyx_n_s_NO_SYMBOL;
static PyObject *__pyx_n_s_NULL_PROPERTIES;
static PyObject *__pyx_kp_u_None;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_O_DETERMINISTIC;
static PyObject *__pyx_n_s_O_EPSILONS;
static PyObject *__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES;
static PyObject *__pyx_n_s_O_LABEL_SORTED;
static PyObject *__pyx_kp_u_Operation_failed;
static PyObject *__pyx_kp_s_Override_the_default_token_type;
static PyObject *__pyx_n_s_POS_TRINARY_PROPERTIES;
static PyObject *__pyx_n_s_PdtParentheses;
static PyObject *__pyx_n_s_PdtParentheses___iter;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_PointerSymbolTableView;
static PyObject *__pyx_n_s_ProjectType;
static PyObject *__pyx_n_s_QueueType;
static PyObject *__pyx_n_s_RM_SUPERFINAL_PROPERTIES;
static PyObject *__pyx_n_s_RandArcSelection;
static PyObject *__pyx_kp_u_Read_failed;
static PyObject *__pyx_kp_u_Read_failed_2;
static PyObject *__pyx_n_s_ReplaceLabelType;
static PyObject *__pyx_n_s_ReweightType;
static PyObject *__pyx_n_s_SET_ARC_PROPERTIES;
static PyObject *__pyx_n_s_SET_FINAL_PROPERTIES;
static PyObject *__pyx_n_s_SET_START_PROPERTIES;
static PyObject *__pyx_n_s_STATE_SORT_PROPERTIES;
static PyObject *__pyx_n_s_STRING;
static PyObject *__pyx_n_s_SortType;
static PyObject *__pyx_n_s_StateIterator;
static PyObject *__pyx_n_s_StateMapType;
static PyObject *__pyx_n_s_StringPathIterator;
static PyObject *__pyx_n_s_StringPathIterator_istrings;
static PyObject *__pyx_n_s_StringPathIterator_items;
static PyObject *__pyx_n_s_StringPathIterator_ostrings;
static PyObject *__pyx_n_s_StringPathIterator_weights;
static PyObject *__pyx_kp_u_String_compilation_failed;
static PyObject *__pyx_kp_u_String_map_compilation_failed;
static PyObject *__pyx_n_s_SymbolTable;
static PyObject *__pyx_n_s_SymbolTableView;
static PyObject *__pyx_n_s_TOP_SORTED;
static PyObject *__pyx_n_s_TRINARY_PROPERTIES;
static PyObject *__pyx_kp_u_The_lower_bound_must_be_an_integ;
static PyObject *__pyx_n_s_TokenType;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UNWEIGHTED;
static PyObject *__pyx_n_s_UNWEIGHTED_CYCLES;
static PyObject *__pyx_kp_u_Unknown_PDT_compose_filter_type;
static PyObject *__pyx_kp_u_Unknown_PDT_parser_type;
static PyObject *__pyx_kp_u_Unknown_arc_type;
static PyObject *__pyx_kp_u_Unknown_context_dependent_rewrit;
static PyObject *__pyx_kp_u_Unknown_context_dependent_rewrit_2;
static PyObject *__pyx_kp_u_Unknown_mode;
static PyObject *__pyx_kp_u_Unknown_token_type;
static PyObject *__pyx_n_s_UnsupportedOperation;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_WEIGHTED;
static PyObject *__pyx_n_s_WEIGHTED_CYCLES;
static PyObject *__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES;
static PyObject *__pyx_n_s_Weight;
static PyObject *__pyx_n_s_WeightLike;
static PyObject *__pyx_kp_u_Write_failed;
static PyObject *__pyx_kp_u__16;
static PyObject *__pyx_kp_u__18;
static PyObject *__pyx_kp_u__19;
static PyObject *__pyx_kp_u__3;
static PyObject *__pyx_n_s_accep;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_pair;
static PyObject *__pyx_n_s_add_triple;
static PyObject *__pyx_n_s_arc_type;
static PyObject *__pyx_n_s_arcmap;
static PyObject *__pyx_n_s_arcsort;
static PyObject *__pyx_n_s_arg1;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_assignment;
static PyObject *__pyx_n_s_astring;
static PyObject *__pyx_kp_u_at_0x;
static PyObject *__pyx_kp_u_at_0x_2;
static PyObject *__pyx_n_u_auto;
static PyObject *__pyx_n_u_c;
static PyObject *__pyx_n_s_call_arc_labeling;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_closed;
static PyObject *__pyx_n_s_closure;
static PyObject *__pyx_n_s_comp_patch;
static PyObject *__pyx_n_s_comp_patch_locals_patch;
static PyObject *__pyx_n_s_compact_symbol_table;
static PyObject *__pyx_n_s_compose;
static PyObject *__pyx_n_s_compose_filter;
static PyObject *__pyx_n_s_compose_filter_2;
static PyObject *__pyx_n_s_compose_patch;
static PyObject *__pyx_n_s_compose_patch_locals_patch;
static PyObject *__pyx_n_s_compute_props;
static PyObject *__pyx_n_s_concat;
static PyObject *__pyx_n_s_connect;
static PyObject *__pyx_kp_u_const_pointer_SymbolTableView;
static PyObject *__pyx_n_s_contextlib;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_copy_patch;
static PyObject *__pyx_n_s_copy_patch_locals_patch;
static PyObject *__pyx_n_s_create;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_u_default;
static PyObject *__pyx_n_s_default_token_type;
static PyObject *__pyx_n_s_default_token_type___enter;
static PyObject *__pyx_n_s_default_token_type___exit;
static PyObject *__pyx_n_s_default_token_type___init;
static PyObject *__pyx_n_s_determinize;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_difference;
static PyObject *__pyx_n_s_difference_patch;
static PyObject *__pyx_n_s_difference_patch_locals_patch;
static PyObject *__pyx_n_s_direction;
static PyObject *__pyx_n_s_disambiguate;
static PyObject *__pyx_n_s_divide;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_done;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_epsilon_on_replace;
static PyObject *__pyx_n_s_epsnormalize;
static PyObject *__pyx_n_s_equal;
static PyObject *__pyx_n_s_equivalent;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_exc;
static PyObject *__pyx_n_s_exc_type;
static PyObject *__pyx_n_s_exc_value;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_kp_s_extensions__pynini_pyx;
static PyObject *__pyx_n_s_far_type;
static PyObject *__pyx_n_u_fifo;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_find;
static PyObject *__pyx_n_s_fnc;
static PyObject *__pyx_n_s_from_pywrapfst;
static PyObject *__pyx_n_s_fst;
static PyObject *__pyx_n_s_fst1;
static PyObject *__pyx_n_s_fst1_2;
static PyObject *__pyx_n_s_fst2;
static PyObject *__pyx_n_s_fst2_2;
static PyObject *__pyx_n_s_fst_2;
static PyObject *__pyx_n_s_fsts;
static PyObject *__pyx_n_s_fsts2;
static PyObject *__pyx_n_s_functools;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get_fst;
static PyObject *__pyx_n_s_get_key;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_u_input;
static PyObject *__pyx_n_s_input_token_type;
static PyObject *__pyx_n_s_intersect;
static PyObject *__pyx_n_s_invert;
static PyObject *__pyx_n_s_io;
static PyObject *__pyx_n_s_isomorphic;
static PyObject *__pyx_n_s_istring;
static PyObject *__pyx_n_s_istrings;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_keep_parentheses;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_label;
static PyObject *__pyx_n_u_left;
static PyObject *__pyx_n_s_left_mpdt;
static PyObject *__pyx_n_s_left_paren_prefix;
static PyObject *__pyx_n_s_left_pdt;
static PyObject *__pyx_n_s_lines;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_u_ltr;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_merge_symbol_table;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_minimize;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_kp_u_mode_2;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_mpdt_reverse;
static PyObject *__pyx_n_s_mu;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_u_neither;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_next_2;
static PyObject *__pyx_kp_u_not;
static PyObject *__pyx_n_s_nu;
static PyObject *__pyx_n_u_obl;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_optimize;
static PyObject *__pyx_n_s_opts;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_ostring;
static PyObject *__pyx_n_s_ostrings;
static PyObject *__pyx_n_s_output_token_type;
static PyObject *__pyx_n_s_pairs;
static PyObject *__pyx_n_u_paren;
static PyObject *__pyx_n_s_parens;
static PyObject *__pyx_n_s_patch;
static PyObject *__pyx_n_s_path_gc;
static PyObject *__pyx_n_s_paths;
static PyObject *__pyx_n_s_pdt_compose;
static PyObject *__pyx_n_s_pdt_expand;
static PyObject *__pyx_n_s_pdt_parser_type;
static PyObject *__pyx_n_s_pdt_replace;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_plus;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_power;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_project;
static PyObject *__pyx_n_s_prune;
static PyObject *__pyx_n_s_push;
static PyObject *__pyx_n_s_pynini;
static PyObject *__pyx_n_s_pywrapfst;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Far;
static PyObject *__pyx_n_s_pyx_unpickle_MPdtParentheses;
static PyObject *__pyx_n_s_pyx_unpickle_PdtParentheses;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_queue_type;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_u_r;
static PyObject *__pyx_n_s_randequivalent;
static PyObject *__pyx_n_s_randgen;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_s_read_from_string;
static PyObject *__pyx_n_s_read_from_string_2;
static PyObject *__pyx_n_u_readable;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_relabel_pairs;
static PyObject *__pyx_n_s_relabel_tables;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_result_fst;
static PyObject *__pyx_n_s_result_parens;
static PyObject *__pyx_n_s_return_arc_labeling;
static PyObject *__pyx_n_s_return_label;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_reweight;
static PyObject *__pyx_n_s_right_paren_prefix;
static PyObject *__pyx_n_s_rmepsilon;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_kp_s_self__paths_cannot_be_converted;
static PyObject *__pyx_kp_s_self__symbols_cannot_be_converte;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shortestdistance;
static PyObject *__pyx_n_s_shortestdistance_patch;
static PyObject *__pyx_n_s_shortestdistance_patch_locals_p;
static PyObject *__pyx_n_s_shortestpath;
static PyObject *__pyx_n_s_sigma_star;
static PyObject *__pyx_n_u_standard;
static PyObject *__pyx_n_s_start_paren_labels;
static PyObject *__pyx_n_s_statemap;
static PyObject *__pyx_n_s_string;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_symbols;
static PyObject *__pyx_n_s_synchronize;
static PyObject *__pyx_n_s_tau;
static PyObject *__pyx_n_s_tb;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_times;
static PyObject *__pyx_n_s_token_type;
static PyObject *__pyx_n_s_token_type_2;
static PyObject *__pyx_n_s_topsort;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_typing;
static PyObject *__pyx_kp_u_typing_Literal_ltr_rtl_sim;
static PyObject *__pyx_kp_u_typing_Literal_obl_opt;
static PyObject *__pyx_kp_u_typing_Literal_r_w;
static PyObject *__pyx_kp_u_typing_Union_Fst_str;
static PyObject *__pyx_kp_u_typing_Union_SymbolTableView_typ;
static PyObject *__pyx_n_s_union;
static PyObject *__pyx_n_s_union_locals_genexpr;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_weight;
static PyObject *__pyx_n_s_weight_2;
static PyObject *__pyx_n_s_weights;
static PyObject *__pyx_n_s_wraps;
static PyObject *__pyx_n_u_writable;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_u_x;
static PyObject *__pyx_pf_7_pynini_18default_token_type___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_18default_token_type_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_18default_token_type_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
static int __pyx_pf_7_pynini_3Fst___init__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_arc_type); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_2from_pywrapfst(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_10_pywrapfst_Fst *__pyx_v_fst); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_4read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_6read_from_string(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_state); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_8__reduce__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_10paths(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_12string(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_14copy(struct __pyx_obj_7_pynini_Fst *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_16closure(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int32_t __pyx_v_lower, int32_t __pyx_v_upper); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_4plus___get__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_4ques___get__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_4star___get__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_18concat(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_fst2); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_20optimize(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, bool __pyx_v_compute_props); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_5union_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_22union(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_fsts2); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_24__eq__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_26__ne__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_28__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_30__iadd__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_32__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_34__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo); /* proto */
#if PY_VERSION_HEX >= 0x03050000
static PyObject *__pyx_pf_7_pynini_3Fst_36__matmul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7_pynini_3Fst_38__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini_3Fst_40__ior__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7_pynini__from_pywrapfst(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10_pywrapfst_Fst *__pyx_v_fst); /* proto */
static PyObject *__pyx_pf_7_pynini_2_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_4_read_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state); /* proto */
static PyObject *__pyx_pf_7_pynini_6escape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7_pynini_8accep(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_astring, PyObject *__pyx_v_weight, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_10cross(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2); /* proto */
static PyObject *__pyx_pf_7_pynini_12cdrewrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tau, PyObject *__pyx_v_l, PyObject *__pyx_v_r, PyObject *__pyx_v_sigma_star, PyObject *__pyx_v_direction, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_7_pynini_14leniently_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_nu, PyObject *__pyx_v_sigma_star, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect); /* proto */
static PyObject *__pyx_pf_7_pynini_16string_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_18string_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lines, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView___repr__(struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_20generated_symbols(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_pynini_11_1arg_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_22_1arg_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_23_shortestdistance_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_24_shortestdistance_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_14_compose_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_26_compose_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_17_difference_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_28_difference_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_11_comp_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_30_comp_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_32concat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2); /* proto */
static PyObject *__pyx_pf_7_pynini_34replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_call_arc_labeling, PyObject *__pyx_v_return_arc_labeling, bool __pyx_v_epsilon_on_replace, int64_t __pyx_v_return_label); /* proto */
static PyObject *__pyx_pf_7_pynini_36union(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fsts); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses___repr__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_7_pynini_14PdtParentheses_2__len__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_4__iter__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_7copy(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_9add_pair(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_11read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_13write(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_15__reduce_cython__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_14PdtParentheses_17__setstate_cython__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_38pdt_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, PyObject *__pyx_v_compose_filter, bool __pyx_v_left_pdt); /* proto */
static PyObject *__pyx_pf_7_pynini_40pdt_expand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, bool __pyx_v_connect, bool __pyx_v_keep_parentheses, PyObject *__pyx_v_weight); /* proto */
static PyObject *__pyx_pf_7_pynini_42pdt_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_pdt_parser_type, int64_t __pyx_v_start_paren_labels, PyObject *__pyx_v_left_paren_prefix, PyObject *__pyx_v_right_paren_prefix); /* proto */
static PyObject *__pyx_pf_7_pynini_44pdt_reverse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens); /* proto */
static PyObject *__pyx_pf_7_pynini_46pdt_shortestpath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, PyObject *__pyx_v_queue_type, bool __pyx_v_keep_parentheses, bool __pyx_v_path_gc); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses___repr__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_7_pynini_15MPdtParentheses_2__len__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_4__iter__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_7copy(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_9add_triple(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int64_t __pyx_v_assignment); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_11read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_13write(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_15__reduce_cython__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_17__setstate_cython__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_48mpdt_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, PyObject *__pyx_v_compose_filter, bool __pyx_v_left_mpdt); /* proto */
static PyObject *__pyx_pf_7_pynini_50mpdt_expand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, bool __pyx_v_connect, bool __pyx_v_keep_parentheses); /* proto */
static PyObject *__pyx_pf_7_pynini_52mpdt_reverse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator___repr__(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static int __pyx_pf_7_pynini_19_StringPathIterator_2__init__(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_4done(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_6error(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_8ilabels(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_10olabels(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_12istring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_14istrings(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_17items(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_20next(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_22reset(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_24ostring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_26ostrings(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_29weight(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_31weights(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_34__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_36__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7_pynini_3Far___init__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_far_type); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_2__repr__(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_4error(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_6arc_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_8closed(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_10far_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_12mode(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_14name(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_16done(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_18find(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_20get_fst(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_22get_key(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_24next(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_26reset(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_28__getitem__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_30__next__(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_32__iter__(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_34add(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst); /* proto */
static int __pyx_pf_7_pynini_3Far_36__setitem__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_38close(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_40__enter__(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_42__exit__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_44__reduce_cython__(struct __pyx_obj_7_pynini_Far *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7_pynini_3Far_46__setstate_cython__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_11_copy_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_arg1, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7_pynini_54_copy_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc); /* proto */
static PyObject *__pyx_pf_7_pynini_56__pyx_unpickle_PdtParentheses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_58__pyx_unpickle_MPdtParentheses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7_pynini_60__pyx_unpickle_Far(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_7_pynini_Fst(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini__PointerSymbolTableView(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini_PdtParentheses(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini_MPdtParentheses(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini__StringPathIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini_Far(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct__union(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_2__1arg_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_3__shortestdistance_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_4__compose_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_5__difference_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_6__comp_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_8___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_9_istrings(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_10_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_11_ostrings(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_12_weights(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_13__copy_patch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_7916983;
static PyObject *__pyx_int_127029315;
static PyObject *__pyx_int_213039201;
static int64_t __pyx_k__17;
static int64_t __pyx_k__20;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__43;
static PyObject *__pyx_codeobj__45;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__57;
static PyObject *__pyx_codeobj__59;
/* Late includes */

/* "_pynini.pyx":156
 * 
 * 
 * cdef _TokenType _get_token_type(const string &token_type) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate TokenType enum value.
 * 
 */

static fst::TokenType __pyx_f_7_pynini__get_token_type(std::string const &__pyx_v_token_type) {
  fst::TokenType __pyx_v__token_type;
  fst::TokenType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_token_type", 0);

  /* "_pynini.pyx":174
 *   """
 *   cdef _TokenType _token_type
 *   if not GetTokenType(token_type, addr(_token_type)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown token type: {token_type}")
 *   return _token_type
 */
  __pyx_t_1 = ((!(fst::script::GetTokenType(__pyx_v_token_type, (&__pyx_v__token_type)) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":175
 *   cdef _TokenType _token_type
 *   if not GetTokenType(token_type, addr(_token_type)):
 *     raise FstArgError(f"Unknown token type: {token_type}")             # <<<<<<<<<<<<<<
 *   return _token_type
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_token_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_token_type, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __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, 175, __pyx_L1_error)

    /* "_pynini.pyx":174
 *   """
 *   cdef _TokenType _token_type
 *   if not GetTokenType(token_type, addr(_token_type)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown token type: {token_type}")
 *   return _token_type
 */
  }

  /* "_pynini.pyx":176
 *   if not GetTokenType(token_type, addr(_token_type)):
 *     raise FstArgError(f"Unknown token type: {token_type}")
 *   return _token_type             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v__token_type;
  goto __pyx_L0;

  /* "_pynini.pyx":156
 * 
 * 
 * cdef _TokenType _get_token_type(const string &token_type) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate TokenType enum value.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._get_token_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (fst::TokenType) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":179
 * 
 * 
 * cdef _CDRewriteDirection _get_cdrewrite_direction(             # <<<<<<<<<<<<<<
 *     const string &direction) except *:
 *   """Matches string with the appropriate CDRewriteDirection enum value.
 */

static enum fst::CDRewriteDirection __pyx_f_7_pynini__get_cdrewrite_direction(std::string const &__pyx_v_direction) {
  enum fst::CDRewriteDirection __pyx_v__direction;
  enum fst::CDRewriteDirection __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_cdrewrite_direction", 0);

  /* "_pynini.pyx":198
 *   """
 *   cdef _CDRewriteDirection _direction
 *   if not GetCDRewriteDirection(direction, addr(_direction)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite direction: {direction}")
 */
  __pyx_t_1 = ((!(fst::script::GetCDRewriteDirection(__pyx_v_direction, (&__pyx_v__direction)) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":199
 *   cdef _CDRewriteDirection _direction
 *   if not GetCDRewriteDirection(direction, addr(_direction)):
 *     raise FstArgError(             # <<<<<<<<<<<<<<
 *         f"Unknown context-dependent rewrite direction: {direction}")
 *   return _direction
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "_pynini.pyx":200
 *   if not GetCDRewriteDirection(direction, addr(_direction)):
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite direction: {direction}")             # <<<<<<<<<<<<<<
 *   return _direction
 * 
 */
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_direction); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_context_dependent_rewrit, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __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, 199, __pyx_L1_error)

    /* "_pynini.pyx":198
 *   """
 *   cdef _CDRewriteDirection _direction
 *   if not GetCDRewriteDirection(direction, addr(_direction)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite direction: {direction}")
 */
  }

  /* "_pynini.pyx":201
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite direction: {direction}")
 *   return _direction             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v__direction;
  goto __pyx_L0;

  /* "_pynini.pyx":179
 * 
 * 
 * cdef _CDRewriteDirection _get_cdrewrite_direction(             # <<<<<<<<<<<<<<
 *     const string &direction) except *:
 *   """Matches string with the appropriate CDRewriteDirection enum value.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._get_cdrewrite_direction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (enum fst::CDRewriteDirection) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":204
 * 
 * 
 * cdef _CDRewriteMode _get_cdrewrite_mode(const string &mode) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate CDRewriteMode enum value.
 * 
 */

static enum fst::CDRewriteMode __pyx_f_7_pynini__get_cdrewrite_mode(std::string const &__pyx_v_mode) {
  enum fst::CDRewriteMode __pyx_v__mode;
  enum fst::CDRewriteMode __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_cdrewrite_mode", 0);

  /* "_pynini.pyx":222
 *   """
 *   cdef _CDRewriteMode _mode
 *   if not GetCDRewriteMode(mode, addr(_mode)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite mode: {mode}")
 */
  __pyx_t_1 = ((!(fst::script::GetCDRewriteMode(__pyx_v_mode, (&__pyx_v__mode)) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":223
 *   cdef _CDRewriteMode _mode
 *   if not GetCDRewriteMode(mode, addr(_mode)):
 *     raise FstArgError(             # <<<<<<<<<<<<<<
 *         f"Unknown context-dependent rewrite mode: {mode}")
 *   return _mode
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "_pynini.pyx":224
 *   if not GetCDRewriteMode(mode, addr(_mode)):
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite mode: {mode}")             # <<<<<<<<<<<<<<
 *   return _mode
 * 
 */
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_context_dependent_rewrit_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __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, 223, __pyx_L1_error)

    /* "_pynini.pyx":222
 *   """
 *   cdef _CDRewriteMode _mode
 *   if not GetCDRewriteMode(mode, addr(_mode)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite mode: {mode}")
 */
  }

  /* "_pynini.pyx":225
 *     raise FstArgError(
 *         f"Unknown context-dependent rewrite mode: {mode}")
 *   return _mode             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v__mode;
  goto __pyx_L0;

  /* "_pynini.pyx":204
 * 
 * 
 * cdef _CDRewriteMode _get_cdrewrite_mode(const string &mode) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate CDRewriteMode enum value.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._get_cdrewrite_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (enum fst::CDRewriteMode) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":228
 * 
 * 
 * cdef PdtComposeFilter _get_pdt_compose_filter(             # <<<<<<<<<<<<<<
 *     const string &compose_filter) except *:
 *   """Matches string with the appropriate PdtComposeFilter enum value.
 */

static fst::PdtComposeFilter __pyx_f_7_pynini__get_pdt_compose_filter(std::string const &__pyx_v_compose_filter) {
  fst::PdtComposeFilter __pyx_v__compose_filter;
  fst::PdtComposeFilter __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_pdt_compose_filter", 0);

  /* "_pynini.pyx":244
 *   """
 *   cdef PdtComposeFilter _compose_filter
 *   if not GetPdtComposeFilter(compose_filter, addr(_compose_filter)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown PDT compose filter type: {compose_filter}")
 *   return _compose_filter
 */
  __pyx_t_1 = ((!(fst::script::GetPdtComposeFilter(__pyx_v_compose_filter, (&__pyx_v__compose_filter)) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":245
 *   cdef PdtComposeFilter _compose_filter
 *   if not GetPdtComposeFilter(compose_filter, addr(_compose_filter)):
 *     raise FstArgError(f"Unknown PDT compose filter type: {compose_filter}")             # <<<<<<<<<<<<<<
 *   return _compose_filter
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_compose_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_PDT_compose_filter_type, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __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, 245, __pyx_L1_error)

    /* "_pynini.pyx":244
 *   """
 *   cdef PdtComposeFilter _compose_filter
 *   if not GetPdtComposeFilter(compose_filter, addr(_compose_filter)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown PDT compose filter type: {compose_filter}")
 *   return _compose_filter
 */
  }

  /* "_pynini.pyx":246
 *   if not GetPdtComposeFilter(compose_filter, addr(_compose_filter)):
 *     raise FstArgError(f"Unknown PDT compose filter type: {compose_filter}")
 *   return _compose_filter             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v__compose_filter;
  goto __pyx_L0;

  /* "_pynini.pyx":228
 * 
 * 
 * cdef PdtComposeFilter _get_pdt_compose_filter(             # <<<<<<<<<<<<<<
 *     const string &compose_filter) except *:
 *   """Matches string with the appropriate PdtComposeFilter enum value.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._get_pdt_compose_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (fst::PdtComposeFilter) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":249
 * 
 * 
 * cdef PdtParserType _get_pdt_parser_type(const string &pdt_parser_type) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate PdtParserType enum value.
 * 
 */

static fst::PdtParserType __pyx_f_7_pynini__get_pdt_parser_type(std::string const &__pyx_v_pdt_parser_type) {
  fst::PdtParserType __pyx_v__pdt_parser_type;
  fst::PdtParserType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_pdt_parser_type", 0);

  /* "_pynini.pyx":267
 *   """
 *   cdef PdtParserType _pdt_parser_type
 *   if not GetPdtParserType(pdt_parser_type, addr(_pdt_parser_type)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown PDT parser type: {pdt_parser_type}")
 *   return _pdt_parser_type
 */
  __pyx_t_1 = ((!(fst::script::GetPdtParserType(__pyx_v_pdt_parser_type, (&__pyx_v__pdt_parser_type)) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":268
 *   cdef PdtParserType _pdt_parser_type
 *   if not GetPdtParserType(pdt_parser_type, addr(_pdt_parser_type)):
 *     raise FstArgError(f"Unknown PDT parser type: {pdt_parser_type}")             # <<<<<<<<<<<<<<
 *   return _pdt_parser_type
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_pdt_parser_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_PDT_parser_type, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __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, 268, __pyx_L1_error)

    /* "_pynini.pyx":267
 *   """
 *   cdef PdtParserType _pdt_parser_type
 *   if not GetPdtParserType(pdt_parser_type, addr(_pdt_parser_type)):             # <<<<<<<<<<<<<<
 *     raise FstArgError(f"Unknown PDT parser type: {pdt_parser_type}")
 *   return _pdt_parser_type
 */
  }

  /* "_pynini.pyx":269
 *   if not GetPdtParserType(pdt_parser_type, addr(_pdt_parser_type)):
 *     raise FstArgError(f"Unknown PDT parser type: {pdt_parser_type}")
 *   return _pdt_parser_type             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v__pdt_parser_type;
  goto __pyx_L0;

  /* "_pynini.pyx":249
 * 
 * 
 * cdef PdtParserType _get_pdt_parser_type(const string &pdt_parser_type) except *:             # <<<<<<<<<<<<<<
 *   """Matches string with the appropriate PdtParserType enum value.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._get_pdt_parser_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (fst::PdtParserType) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":272
 * 
 * 
 * cdef void _maybe_arcsort(MutableFstClass *fst1, MutableFstClass *fst2):             # <<<<<<<<<<<<<<
 *   """Arc-sorts two FST arguments for composition, if necessary.
 * 
 */

static void __pyx_f_7_pynini__maybe_arcsort(fst::script::MutableFstClass *__pyx_v_fst1, fst::script::MutableFstClass *__pyx_v_fst2) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_maybe_arcsort", 0);

  /* "_pynini.pyx":283
 *   # It is probably much quicker to force recomputation of the property (if
 *   # necessary) to call the underlying sort on a vector of arcs.
 *   if fst1.Properties(kOLabelSorted, True) != kOLabelSorted:             # <<<<<<<<<<<<<<
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:
 */
  __pyx_t_1 = ((__pyx_v_fst1->Properties(fst::kOLabelSorted, 1) != fst::kOLabelSorted) != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":284
 *   # necessary) to call the underlying sort on a vector of arcs.
 *   if fst1.Properties(kOLabelSorted, True) != kOLabelSorted:
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)             # <<<<<<<<<<<<<<
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:
 *     ArcSort(fst2, ArcSortType.ILABEL_SORT)
 */
    fst::script::ArcSort(__pyx_v_fst1, fst::script::ArcSortType::OLABEL);

    /* "_pynini.pyx":283
 *   # It is probably much quicker to force recomputation of the property (if
 *   # necessary) to call the underlying sort on a vector of arcs.
 *   if fst1.Properties(kOLabelSorted, True) != kOLabelSorted:             # <<<<<<<<<<<<<<
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:
 */
  }

  /* "_pynini.pyx":285
 *   if fst1.Properties(kOLabelSorted, True) != kOLabelSorted:
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:             # <<<<<<<<<<<<<<
 *     ArcSort(fst2, ArcSortType.ILABEL_SORT)
 * 
 */
  __pyx_t_1 = ((__pyx_v_fst2->Properties(fst::kILabelSorted, 1) != fst::kILabelSorted) != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":286
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:
 *     ArcSort(fst2, ArcSortType.ILABEL_SORT)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    fst::script::ArcSort(__pyx_v_fst2, fst::script::ArcSortType::ILABEL);

    /* "_pynini.pyx":285
 *   if fst1.Properties(kOLabelSorted, True) != kOLabelSorted:
 *     ArcSort(fst1, ArcSortType.OLABEL_SORT)
 *   if fst2.Properties(kILabelSorted, True) != kILabelSorted:             # <<<<<<<<<<<<<<
 *     ArcSort(fst2, ArcSortType.ILABEL_SORT)
 * 
 */
  }

  /* "_pynini.pyx":272
 * 
 * 
 * cdef void _maybe_arcsort(MutableFstClass *fst1, MutableFstClass *fst2):             # <<<<<<<<<<<<<<
 *   """Arc-sorts two FST arguments for composition, if necessary.
 * 
 */

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

/* "_pynini.pyx":309
 *   """
 * 
 *   def __init__(self, token_type):             # <<<<<<<<<<<<<<
 *     self._token_type = token_type
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_18default_token_type_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_18default_token_type_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_18default_token_type_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_18default_token_type_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_token_type = 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_token_type,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_token_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 309, __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, 309, __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_token_type = 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, 309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.default_token_type.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_18default_token_type___init__(__pyx_self, __pyx_v_self, __pyx_v_token_type);

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

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

  /* "_pynini.pyx":310
 * 
 *   def __init__(self, token_type):
 *     self._token_type = token_type             # <<<<<<<<<<<<<<
 * 
 *   def __enter__(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_token_type_2, __pyx_v_token_type) < 0) __PYX_ERR(0, 310, __pyx_L1_error)

  /* "_pynini.pyx":309
 *   """
 * 
 *   def __init__(self, token_type):             # <<<<<<<<<<<<<<
 *     self._token_type = token_type
 * 
 */

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

/* "_pynini.pyx":312
 *     self._token_type = token_type
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_18default_token_type_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_18default_token_type_3__enter__ = {"__enter__", (PyCFunction)__pyx_pw_7_pynini_18default_token_type_3__enter__, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_18default_token_type_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_18default_token_type_2__enter__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_18default_token_type_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  fst::TokenType __pyx_v__token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__symbols;
  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;
  fst::SymbolTable const *__pyx_t_6;
  std::string __pyx_t_7;
  fst::TokenType __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "_pynini.pyx":314
 *   def __enter__(self):
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL             # <<<<<<<<<<<<<<
 *     if isinstance(self._token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL
 */
  __pyx_v__symbols = NULL;

  /* "_pynini.pyx":315
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if isinstance(self._token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> self._token_type)._raw_ptr_or_raise()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_token_type_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "_pynini.pyx":316
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if isinstance(self._token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *       _symbols = (<_SymbolTableView> self._token_type)._raw_ptr_or_raise()
 *     else:
 */
    __pyx_v__token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":317
 *     if isinstance(self._token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> self._token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *     else:
 *       _token_type = _get_token_type(tostring(self._token_type))
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_token_type_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_t_3 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 317, __pyx_L1_error)
    }
    __pyx_t_6 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_t_3)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v__symbols = __pyx_t_6;

    /* "_pynini.pyx":315
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if isinstance(self._token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> self._token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":319
 *       _symbols = (<_SymbolTableView> self._token_type)._raw_ptr_or_raise()
 *     else:
 *       _token_type = _get_token_type(tostring(self._token_type))             # <<<<<<<<<<<<<<
 *     PushDefaults(_token_type, _symbols)
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_token_type_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __pyx_f_10_pywrapfst_tostring(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_f_7_pynini__get_token_type(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error)
    __pyx_v__token_type = __pyx_t_8;
  }
  __pyx_L3:;

  /* "_pynini.pyx":320
 *     else:
 *       _token_type = _get_token_type(tostring(self._token_type))
 *     PushDefaults(_token_type, _symbols)             # <<<<<<<<<<<<<<
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):
 */
  fst::PushDefaults(__pyx_v__token_type, __pyx_v__symbols);

  /* "_pynini.pyx":312
 *     self._token_type = token_type
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 */

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

/* "_pynini.pyx":322
 *     PushDefaults(_token_type, _symbols)
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *     PopDefaults()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_18default_token_type_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_18default_token_type_5__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_18default_token_type_5__exit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_18default_token_type_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc_type,&__pyx_n_s_exc_value,&__pyx_n_s_traceback,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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 (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 1); __PYX_ERR(0, 322, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 2); __PYX_ERR(0, 322, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 3); __PYX_ERR(0, 322, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 322, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_exc_type = values[1];
    __pyx_v_exc_value = values[2];
    __pyx_v_traceback = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.default_token_type.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_18default_token_type_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);

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

static PyObject *__pyx_pf_7_pynini_18default_token_type_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "_pynini.pyx":323
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):
 *     PopDefaults()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  fst::PopDefaults();

  /* "_pynini.pyx":322
 *     PushDefaults(_token_type, _symbols)
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *     PopDefaults()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":343
 *   """
 * 
 *   cdef void _from_MutableFstClass(self, MutableFstClass *tfst):             # <<<<<<<<<<<<<<
 *     """
 *     _from_MutableFstClass(tfst)
 */

static void __pyx_f_7_pynini_3Fst__from_MutableFstClass(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, fst::script::MutableFstClass *__pyx_v_tfst) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_from_MutableFstClass", 0);

  /* "_pynini.pyx":351
 *     This method is not visible to Python users.
 *     """
 *     self._fst.reset(tfst)             # <<<<<<<<<<<<<<
 *     self._mfst = static_pointer_cast[MutableFstClass, FstClass](self._fst)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 351, __pyx_L1_error)
  }
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._fst.reset(__pyx_v_tfst);

  /* "_pynini.pyx":352
 *     """
 *     self._fst.reset(tfst)
 *     self._mfst = static_pointer_cast[MutableFstClass, FstClass](self._fst)             # <<<<<<<<<<<<<<
 * 
 *   def __init__(self, arc_type="standard"):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 352, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 352, __pyx_L1_error)
  }
  __pyx_v_self->__pyx_base.__pyx_base._mfst = std::static_pointer_cast<fst::script::MutableFstClass,fst::script::FstClass>(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._fst);

  /* "_pynini.pyx":343
 *   """
 * 
 *   cdef void _from_MutableFstClass(self, MutableFstClass *tfst):             # <<<<<<<<<<<<<<
 *     """
 *     _from_MutableFstClass(tfst)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_pynini.Fst._from_MutableFstClass", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_pynini.pyx":354
 *     self._mfst = static_pointer_cast[MutableFstClass, FstClass](self._fst)
 * 
 *   def __init__(self, arc_type="standard"):             # <<<<<<<<<<<<<<
 *     cdef unique_ptr[VectorFstClass] _tfst
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))
 */

/* Python wrapper */
static int __pyx_pw_7_pynini_3Fst_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7_pynini_3Fst_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_arc_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arc_type,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_n_u_standard);
    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_arc_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 354, __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_arc_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Fst.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Fst___init__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_arc_type);

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

static int __pyx_pf_7_pynini_3Fst___init__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_arc_type) {
  std::unique_ptr<fst::script::VectorFstClass>  __pyx_v__tfst;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "_pynini.pyx":356
 *   def __init__(self, arc_type="standard"):
 *     cdef unique_ptr[VectorFstClass] _tfst
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))             # <<<<<<<<<<<<<<
 *     if _tfst.get().Properties(kError, True) == kError:
 *        raise FstArgError(f"Unknown arc type: {arc_type}")
 */
  __pyx_t_1 = __pyx_f_10_pywrapfst_tostring(__pyx_v_arc_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error)
  __pyx_v__tfst.reset(new fst::script::VectorFstClass(__pyx_t_1));

  /* "_pynini.pyx":357
 *     cdef unique_ptr[VectorFstClass] _tfst
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))
 *     if _tfst.get().Properties(kError, True) == kError:             # <<<<<<<<<<<<<<
 *        raise FstArgError(f"Unknown arc type: {arc_type}")
 *     self._from_MutableFstClass(_tfst.release())
 */
  __pyx_t_2 = ((__pyx_v__tfst.get()->Properties(fst::kError, 1) == fst::kError) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "_pynini.pyx":358
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))
 *     if _tfst.get().Properties(kError, True) == kError:
 *        raise FstArgError(f"Unknown arc type: {arc_type}")             # <<<<<<<<<<<<<<
 *     self._from_MutableFstClass(_tfst.release())
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_arc_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_arc_type, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 358, __pyx_L1_error)

    /* "_pynini.pyx":357
 *     cdef unique_ptr[VectorFstClass] _tfst
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))
 *     if _tfst.get().Properties(kError, True) == kError:             # <<<<<<<<<<<<<<
 *        raise FstArgError(f"Unknown arc type: {arc_type}")
 *     self._from_MutableFstClass(_tfst.release())
 */
  }

  /* "_pynini.pyx":359
 *     if _tfst.get().Properties(kError, True) == kError:
 *        raise FstArgError(f"Unknown arc type: {arc_type}")
 *     self._from_MutableFstClass(_tfst.release())             # <<<<<<<<<<<<<<
 * 
 *   @classmethod
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_from_MutableFstClass");
    __PYX_ERR(0, 359, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_from_MutableFstClass(__pyx_v_self, __pyx_v__tfst.release());

  /* "_pynini.pyx":354
 *     self._mfst = static_pointer_cast[MutableFstClass, FstClass](self._fst)
 * 
 *   def __init__(self, arc_type="standard"):             # <<<<<<<<<<<<<<
 *     cdef unique_ptr[VectorFstClass] _tfst
 *     _tfst.reset(new VectorFstClass(tostring(arc_type)))
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("_pynini.Fst.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":362
 * 
 *   @classmethod
 *   def from_pywrapfst(cls, _Fst fst):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.from_pywrapfst(fst)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_3from_pywrapfst(PyObject *__pyx_v_cls, PyObject *__pyx_v_fst); /*proto*/
static char __pyx_doc_7_pynini_3Fst_2from_pywrapfst[] = "\n    Fst.from_pywrapfst(fst)\n\n    Constructs a Pynini FST from a _pywrapfst.Fst.\n\n    This class method converts an FST from the pywrapfst module (_pywrapfst.Fst\n    or its derivatives) to a Pynini.Fst. This is essentially a downcasting\n    operation which grants the object additional instance methods, including an\n    enhanced `closure`, `paths`, and `string`. The input FST is not invalidated,\n    but mutation of the input or output object while the other is still in scope\n    will trigger a deep copy.\n\n    Args:\n      fst: Input FST of type _pywrapfst.Fst.\n\n    Returns:\n      An FST of type Fst.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_3from_pywrapfst(PyObject *__pyx_v_cls, PyObject *__pyx_v_fst) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_pywrapfst (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fst), __pyx_ptype_10_pywrapfst_Fst, 1, "fst", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_3Fst_2from_pywrapfst(((PyTypeObject*)__pyx_v_cls), ((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_fst));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_3Fst_2from_pywrapfst(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_10_pywrapfst_Fst *__pyx_v_fst) {
  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("from_pywrapfst", 0);

  /* "_pynini.pyx":381
 *       An FST of type Fst.
 *     """
 *     return _from_pywrapfst(fst)             # <<<<<<<<<<<<<<
 * 
 *   @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__from_pywrapfst(__pyx_v_fst, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":362
 * 
 *   @classmethod
 *   def from_pywrapfst(cls, _Fst fst):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.from_pywrapfst(fst)
 */

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

/* "_pynini.pyx":384
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(filename)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_5read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_7_pynini_3Fst_4read[] = "\n    Fst.read(filename)\n\n    Reads an FST from a file.\n\n    Args:\n      filename: The string location of the input file.\n\n    Returns:\n      An FST.\n\n    Raises:\n      FstIOError: Read failed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_5read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_4read(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_3Fst_4read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  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("read", 0);

  /* "_pynini.pyx":399
 *       FstIOError: Read failed.
 *     """
 *     return _read(filename)             # <<<<<<<<<<<<<<
 * 
 *   @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__read(__pyx_v_filename, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":384
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(filename)
 */

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

/* "_pynini.pyx":402
 * 
 *   @classmethod
 *   def read_from_string(cls, state):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(string)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_7read_from_string(PyObject *__pyx_v_cls, PyObject *__pyx_v_state); /*proto*/
static char __pyx_doc_7_pynini_3Fst_6read_from_string[] = "\n    Fst.read(string)\n\n    Reads an FST from a serialized string.\n\n    Args:\n      state: A string containing the serialized FST.\n\n    Returns:\n      An FST.\n\n    Raises:\n      FstIOError: Read failed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_7read_from_string(PyObject *__pyx_v_cls, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_from_string (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_6read_from_string(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_state));

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

static PyObject *__pyx_pf_7_pynini_3Fst_6read_from_string(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_state) {
  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("read_from_string", 0);

  /* "_pynini.pyx":417
 *       FstIOError: Read failed.
 *     """
 *     return _read_from_string(state)             # <<<<<<<<<<<<<<
 * 
 *   # Registers the class for pickling.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__read_from_string(__pyx_v_state, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":402
 * 
 *   @classmethod
 *   def read_from_string(cls, state):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(string)
 */

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

/* "_pynini.pyx":421
 *   # Registers the class for pickling.
 * 
 *   def __reduce__(self):             # <<<<<<<<<<<<<<
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_9__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_9__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_8__reduce__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Fst_8__reduce__(struct __pyx_obj_7_pynini_Fst *__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("__reduce__", 0);

  /* "_pynini.pyx":422
 * 
 *   def __reduce__(self):
 *     return (_read_from_string, (self.write_to_string(),))             # <<<<<<<<<<<<<<
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_read_from_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "write_to_string");
    __PYX_ERR(0, 422, __pyx_L1_error)
  }
  __pyx_t_2 = ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.write_to_string(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_self), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":421
 *   # Registers the class for pickling.
 * 
 *   def __reduce__(self):             # <<<<<<<<<<<<<<
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 */

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

/* "_pynini.pyx":424
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,             # <<<<<<<<<<<<<<
 *                                   output_token_type=None):
 *     """
 */

static PyObject *__pyx_pw_7_pynini_3Fst_11paths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini__StringPathIterator *__pyx_f_7_pynini_3Fst_paths(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_paths *__pyx_optional_args) {
  PyObject *__pyx_v_input_token_type = ((PyObject *)Py_None);

  /* "_pynini.pyx":425
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,
 *                                   output_token_type=None):             # <<<<<<<<<<<<<<
 *     """
 *     paths(self, input_token_type=None, output_token_type=None)
 */
  PyObject *__pyx_v_output_token_type = ((PyObject *)Py_None);
  struct __pyx_obj_7_pynini__StringPathIterator *__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("paths", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_token_type = __pyx_optional_args->input_token_type;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_output_token_type = __pyx_optional_args->output_token_type;
      }
    }
  }

  /* "_pynini.pyx":424
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,             # <<<<<<<<<<<<<<
 *                                   output_token_type=None):
 *     """
 */
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_paths); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Fst_11paths)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_input_token_type, __pyx_v_output_token_type};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_input_token_type, __pyx_v_output_token_type};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __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_INCREF(__pyx_v_input_token_type);
          __Pyx_GIVEREF(__pyx_v_input_token_type);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_input_token_type);
          __Pyx_INCREF(__pyx_v_output_token_type);
          __Pyx_GIVEREF(__pyx_v_output_token_type);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_output_token_type);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini__StringPathIterator))))) __PYX_ERR(0, 424, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":460
 *       FstOpError: Operation failed.
 *     """
 *     return _StringPathIterator(self, input_token_type, output_token_type)             # <<<<<<<<<<<<<<
 * 
 *   cpdef string string(self, token_type=None) except *:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_input_token_type);
  __Pyx_GIVEREF(__pyx_v_input_token_type);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_input_token_type);
  __Pyx_INCREF(__pyx_v_output_token_type);
  __Pyx_GIVEREF(__pyx_v_output_token_type);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_output_token_type);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7_pynini__StringPathIterator), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":424
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,             # <<<<<<<<<<<<<<
 *                                   output_token_type=None):
 *     """
 */

  /* 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("_pynini.Fst.paths", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_11paths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_3Fst_10paths[] = "\n    paths(self, input_token_type=None, output_token_type=None)\n\n    Creates iterator over all string paths in an acyclic FST.\n\n    This method returns an iterator over all paths (represented as pairs of\n    strings and an associated path weight) through an acyclic FST. This\n    operation is only feasible when the FST is acyclic. Depending on the\n    requested token type, the arc labels along the input and output sides of a\n    path are interpreted as UTF-8-encoded Unicode strings, raw bytes, or a\n    concatenation of string labels from a symbol table.\n\n    Args:\n      input_token_type: An optional string indicating how the input strings are\n          to be constructed from arc labels---one of: \"byte\" (interprets arc\n          labels as raw bytes), \"utf8\" (interprets arc labels as Unicode code\n          points), \"symbol\" (interprets arc labels using the input symbol\n          table), or a SymbolTable. If not set, or set to None, the value is set\n          to the default token_type, which begins as \"byte\", but can be\n          overridden for regions of code using the default_token_type context\n          manager.\n      output_token_type: An optional string indicating how the output strings\n          are to be constructed from arc labels---one of: \"byte\" (interprets arc\n          labels as raw bytes), \"utf8\" (interprets arc labels as Unicode code\n          points), \"symbol\" (interprets arc labels using the input symbol\n          table), or a SymbolTable. If not set, or set to None, the value is set\n          to the default token_type, which begins as \"byte\", but can be\n          overridden for regions of code using the default_token_type context\n          manager.\n\n    Raises:\n      FstArgError: Unknown token type.\n      FstOpError: Operation failed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_11paths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_input_token_type = 0;
  PyObject *__pyx_v_output_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("paths (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_token_type,&__pyx_n_s_output_token_type,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);

    /* "_pynini.pyx":425
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,
 *                                   output_token_type=None):             # <<<<<<<<<<<<<<
 *     """
 *     paths(self, input_token_type=None, output_token_type=None)
 */
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_token_type);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_token_type);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "paths") < 0)) __PYX_ERR(0, 424, __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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_input_token_type = values[0];
    __pyx_v_output_token_type = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("paths", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Fst.paths", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Fst_10paths(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_input_token_type, __pyx_v_output_token_type);

  /* "_pynini.pyx":424
 *     return (_read_from_string, (self.write_to_string(),))
 * 
 *   cpdef _StringPathIterator paths(self, input_token_type=None,             # <<<<<<<<<<<<<<
 *                                   output_token_type=None):
 *     """
 */

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

static PyObject *__pyx_pf_7_pynini_3Fst_10paths(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_3Fst_paths __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("paths", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.input_token_type = __pyx_v_input_token_type;
  __pyx_t_2.output_token_type = __pyx_v_output_token_type;
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7_pynini_Fst->paths(__pyx_v_self, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":462
 *     return _StringPathIterator(self, input_token_type, output_token_type)
 * 
 *   cpdef string string(self, token_type=None) except *:             # <<<<<<<<<<<<<<
 *     """
 *     string(self, token_type=None)
 */

static PyObject *__pyx_pw_7_pynini_3Fst_13string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static std::string __pyx_f_7_pynini_3Fst_string(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_string *__pyx_optional_args) {
  PyObject *__pyx_v_token_type = ((PyObject *)Py_None);
  fst::TokenType __pyx_v__token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__symbols;
  std::string __pyx_v_result;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  fst::SymbolTable const *__pyx_t_8;
  fst::TokenType __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_token_type = __pyx_optional_args->token_type;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Fst_13string)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_token_type) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_token_type);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":496
 *     """
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL             # <<<<<<<<<<<<<<
 *     if token_type is None:
 *       _token_type = GetDefaultTokenType()
 */
  __pyx_v__symbols = NULL;

  /* "_pynini.pyx":497
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if token_type is None:             # <<<<<<<<<<<<<<
 *       _token_type = GetDefaultTokenType()
 *       _symbols = GetDefaultSymbols()
 */
  __pyx_t_6 = (__pyx_v_token_type == Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "_pynini.pyx":498
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if token_type is None:
 *       _token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *       _symbols = GetDefaultSymbols()
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":499
 *     if token_type is None:
 *       _token_type = GetDefaultTokenType()
 *       _symbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL
 */
    __pyx_v__symbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":497
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 *     if token_type is None:             # <<<<<<<<<<<<<<
 *       _token_type = GetDefaultTokenType()
 *       _symbols = GetDefaultSymbols()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":500
 *       _token_type = GetDefaultTokenType()
 *       _symbols = GetDefaultSymbols()
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_token_type, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":501
 *       _symbols = GetDefaultSymbols()
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *       _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 *     else:
 */
    __pyx_v__token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":502
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *     else:
 *       _token_type = _get_token_type(tostring(token_type))
 */
    if (unlikely(__pyx_v_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 502, __pyx_L1_error)
    }
    __pyx_t_8 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L1_error)
    __pyx_v__symbols = __pyx_t_8;

    /* "_pynini.pyx":500
 *       _token_type = GetDefaultTokenType()
 *       _symbols = GetDefaultSymbols()
 *     elif isinstance(token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _token_type = _TokenType.SYMBOL
 *       _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":504
 *       _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 *     else:
 *       _token_type = _get_token_type(tostring(token_type))             # <<<<<<<<<<<<<<
 *     cdef string result
 *     if not StringPrint(deref(self._fst), addr(result), _token_type, _symbols):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_10_pywrapfst_tostring(__pyx_v_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 504, __pyx_L1_error)
    __pyx_t_9 = __pyx_f_7_pynini__get_token_type(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 504, __pyx_L1_error)
    __pyx_v__token_type = __pyx_t_9;
  }
  __pyx_L3:;

  /* "_pynini.pyx":506
 *       _token_type = _get_token_type(tostring(token_type))
 *     cdef string result
 *     if not StringPrint(deref(self._fst), addr(result), _token_type, _symbols):             # <<<<<<<<<<<<<<
 *       raise FstOpError("Operation failed")
 *     return result
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 506, __pyx_L1_error)
  }
  __pyx_t_6 = ((!(fst::script::StringPrint((*__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._fst), (&__pyx_v_result), __pyx_v__token_type, __pyx_v__symbols) != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "_pynini.pyx":507
 *     cdef string result
 *     if not StringPrint(deref(self._fst), addr(result), _token_type, _symbols):
 *       raise FstOpError("Operation failed")             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __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_u_Operation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_Operation_failed);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __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, 507, __pyx_L1_error)

    /* "_pynini.pyx":506
 *       _token_type = _get_token_type(tostring(token_type))
 *     cdef string result
 *     if not StringPrint(deref(self._fst), addr(result), _token_type, _symbols):             # <<<<<<<<<<<<<<
 *       raise FstOpError("Operation failed")
 *     return result
 */
  }

  /* "_pynini.pyx":508
 *     if not StringPrint(deref(self._fst), addr(result), _token_type, _symbols):
 *       raise FstOpError("Operation failed")
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   # The following all override their definition in MutableFst.
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":462
 *     return _StringPathIterator(self, input_token_type, output_token_type)
 * 
 *   cpdef string string(self, token_type=None) except *:             # <<<<<<<<<<<<<<
 *     """
 *     string(self, token_type=None)
 */

  /* 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("_pynini.Fst.string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_13string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_3Fst_12string[] = "\n    string(self, token_type=None)\n\n    Creates a string from a string FST.\n\n    This method returns the string recognized by the FST as a Python byte or\n    Unicode string. This is only well-defined when the FST is an acceptor and a\n    \"string\" FST (meaning that the start state is numbered 0, and there is\n    exactly one transition from each state i to each state i + 1, there are no\n    other transitions, and the last state is final). Depending on the requested\n    token type, the arc labels are interpreted as a UTF-8-encoded Unicode\n    string, raw bytes, or as a concatenation of string labels from the output\n    symbol table.\n\n    The underlying routine reads only the output labels, so if the FST is\n    not an acceptor, it will be treated as the output projection of the FST.\n\n    Args:\n      token_type: An optional string indicating how the string is to be\n          constructed from arc labels---one of: \"byte\" (interprets arc labels as\n          raw bytes), \"utf8\" (interprets arc labels as Unicode code points), or\n          a SymbolTable. If not set, or set to None, the value is set to the\n          default token_type, which begins as \"byte\", but can be overridden for\n          regions of code using the default_token_type context manager.\n\n    Returns:\n      The string corresponding to (an output projection) of the FST.\n\n    Raises:\n      FstArgError: Unknown token type.\n      FstOpError: Operation failed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_13string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_token_type,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_token_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string") < 0)) __PYX_ERR(0, 462, __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_token_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Fst.string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Fst_12string(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_token_type);

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

static PyObject *__pyx_pf_7_pynini_3Fst_12string(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_token_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  struct __pyx_opt_args_7_pynini_3Fst_string __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.token_type = __pyx_v_token_type;
  __pyx_t_1 = __pyx_vtabptr_7_pynini_Fst->string(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
  __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini.Fst.string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":512
 *   # The following all override their definition in MutableFst.
 * 
 *   cpdef Fst copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

static PyObject *__pyx_pw_7_pynini_3Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Fst_copy(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__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("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Fst_15copy)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 512, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":518
 *     Makes a copy of the FST.
 *     """
 *     return _init_Fst_from_MutableFst(super(_MutableFst, self).copy())             # <<<<<<<<<<<<<<
 * 
 *   def closure(self, int32_t lower=0, int32_t upper=0):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_10_pywrapfst_MutableFst));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_10_pywrapfst_MutableFst));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_10_pywrapfst_MutableFst));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __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_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __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, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_MutableFst))))) __PYX_ERR(0, 518, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__init_Fst_from_MutableFst(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":512
 *   # The following all override their definition in MutableFst.
 * 
 *   cpdef Fst copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

  /* 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("_pynini.Fst.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Fst_14copy[] = "\n    copy(self)\n\n    Makes a copy of the FST.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_14copy(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Fst_14copy(struct __pyx_obj_7_pynini_Fst *__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("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_3Fst_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Fst_copy__pyx_wrap_1(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int __pyx_skip_dispatch) {
  return __pyx_f_7_pynini_3Fst_copy(__pyx_v_self, __pyx_skip_dispatch);
}

/* "_pynini.pyx":520
 *     return _init_Fst_from_MutableFst(super(_MutableFst, self).copy())
 * 
 *   def closure(self, int32_t lower=0, int32_t upper=0):             # <<<<<<<<<<<<<<
 *     """
 *     closure(self, lower)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_17closure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_3Fst_16closure[] = "\n    closure(self, lower)\n    closure(self, lower, upper)\n\n    Computes concatenative closure.\n\n    This operation destructively converts the FST to its concatenative closure.\n    If A transduces string x to y with weight w, then the zero-argument form\n    `A.closure()` mutates A so that it transduces between empty strings with\n    weight 1, transduces string x to y with weight w, transduces xx to yy with\n    weight w \\otimes w, string xxx to yyy with weight w \\otimes w \\otimes w\n    (and so on).\n\n    When called with two optional positive integer arguments, these act as\n    lower and upper bounds, respectively, for the number of cycles through the\n    original FST that the mutated FST permits. Therefore, `A.closure(0, 1)`\n    mutates A so that it permits 0 or 1 cycles; i.e., the mutated A transduces\n    between empty strings or transduces x to y.\n\n    When called with one optional positive integer argument, this argument\n    acts as the lower bound, with the upper bound implicitly set to infinity.\n    Therefore, `A.closure(1)` performs a mutation roughly equivalent to\n    `A.closure()` except that the former does not transduce between empty\n    strings.\n\n    The following are the equivalents for the closure-style syntax used in\n    Perl-style regular expressions:\n\n    Regexp:\t\tThis method:\t\tCopy shortcuts:\n\n    /x?/\t\tx.closure(0, 1)\t\tx.ques\n    /x*/\t\tx.closure()\t\tx.star\n    /x+/\t\tx.closure(1)\t\tx.plus\n    /x{N}/\t\tx.closure(N, N)\t\tx ** N\n    /x{M,N}/\t\tx.closure(M, N)\n    /x{N,}/\t\tx.closure(N)\n    /x{,N}/\t\tx.closure(0, N)\n\n    Args:\n      lower: lower bound.\n      upper: upper bound.\n\n    Returns:\n      self.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_17closure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int32_t __pyx_v_lower;
  int32_t __pyx_v_upper;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("closure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lower,&__pyx_n_s_upper,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lower);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_upper);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "closure") < 0)) __PYX_ERR(0, 520, __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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_lower = __Pyx_PyInt_As_int32_t(values[0]); if (unlikely((__pyx_v_lower == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L3_error)
    } else {
      __pyx_v_lower = ((int32_t)0);
    }
    if (values[1]) {
      __pyx_v_upper = __Pyx_PyInt_As_int32_t(values[1]); if (unlikely((__pyx_v_upper == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L3_error)
    } else {
      __pyx_v_upper = ((int32_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("closure", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 520, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Fst.closure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Fst_16closure(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_lower, __pyx_v_upper);

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

static PyObject *__pyx_pf_7_pynini_3Fst_16closure(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, int32_t __pyx_v_lower, int32_t __pyx_v_upper) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("closure", 0);

  /* "_pynini.pyx":566
 *       self.
 *     """
 *     ConcatRange(self._mfst.get(), lower, upper)             # <<<<<<<<<<<<<<
 *     self._check_mutating_imethod()
 *     return self
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 566, __pyx_L1_error)
  }
  fst::script::ConcatRange(__pyx_v_self->__pyx_base.__pyx_base._mfst.get(), __pyx_v_lower, __pyx_v_upper);

  /* "_pynini.pyx":567
 *     """
 *     ConcatRange(self._mfst.get(), lower, upper)
 *     self._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod");
    __PYX_ERR(0, 567, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_self)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 567, __pyx_L1_error)

  /* "_pynini.pyx":568
 *     ConcatRange(self._mfst.get(), lower, upper)
 *     self._check_mutating_imethod()
 *     return self             # <<<<<<<<<<<<<<
 * 
 *   @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "_pynini.pyx":520
 *     return _init_Fst_from_MutableFst(super(_MutableFst, self).copy())
 * 
 *   def closure(self, int32_t lower=0, int32_t upper=0):             # <<<<<<<<<<<<<<
 *     """
 *     closure(self, lower)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.Fst.closure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":571
 * 
 *   @property
 *   def plus(self):             # <<<<<<<<<<<<<<
 *     """
 *     plus(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_4plus_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_4plus_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_4plus___get__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self));

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

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

  /* "_pynini.pyx":580
 *       An FST copy.
 *     """
 *     cdef Fst result = self.copy()             # <<<<<<<<<<<<<<
 *     Closure(result._mfst.get(), CLOSURE_PLUS)
 *     result._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 580, __pyx_L1_error)
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->copy(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":581
 *     """
 *     cdef Fst result = self.copy()
 *     Closure(result._mfst.get(), CLOSURE_PLUS)             # <<<<<<<<<<<<<<
 *     result._check_mutating_imethod()
 *     return result
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 581, __pyx_L1_error)
  }
  fst::script::Closure(__pyx_v_result->__pyx_base.__pyx_base._mfst.get(), fst::CLOSURE_PLUS);

  /* "_pynini.pyx":582
 *     cdef Fst result = self.copy()
 *     Closure(result._mfst.get(), CLOSURE_PLUS)
 *     result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod");
    __PYX_ERR(0, 582, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 582, __pyx_L1_error)

  /* "_pynini.pyx":583
 *     Closure(result._mfst.get(), CLOSURE_PLUS)
 *     result._check_mutating_imethod()
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":571
 * 
 *   @property
 *   def plus(self):             # <<<<<<<<<<<<<<
 *     """
 *     plus(self)
 */

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

/* "_pynini.pyx":586
 * 
 *   @property
 *   def ques(self):             # <<<<<<<<<<<<<<
 *     """
 *     ques(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_4ques_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_4ques_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_4ques___get__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self));

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

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

  /* "_pynini.pyx":595
 *       An FST copy.
 *     """
 *     cdef Fst result = self.copy()             # <<<<<<<<<<<<<<
 *     ConcatRange(result._mfst.get(), 0, 1)
 *     result._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 595, __pyx_L1_error)
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->copy(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":596
 *     """
 *     cdef Fst result = self.copy()
 *     ConcatRange(result._mfst.get(), 0, 1)             # <<<<<<<<<<<<<<
 *     result._check_mutating_imethod()
 *     return result
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 596, __pyx_L1_error)
  }
  fst::script::ConcatRange(__pyx_v_result->__pyx_base.__pyx_base._mfst.get(), 0, 1);

  /* "_pynini.pyx":597
 *     cdef Fst result = self.copy()
 *     ConcatRange(result._mfst.get(), 0, 1)
 *     result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod");
    __PYX_ERR(0, 597, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error)

  /* "_pynini.pyx":598
 *     ConcatRange(result._mfst.get(), 0, 1)
 *     result._check_mutating_imethod()
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":586
 * 
 *   @property
 *   def ques(self):             # <<<<<<<<<<<<<<
 *     """
 *     ques(self)
 */

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

/* "_pynini.pyx":601
 * 
 *   @property
 *   def star(self):             # <<<<<<<<<<<<<<
 *     """
 *     star(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_4star_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_4star_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_4star___get__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self));

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

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

  /* "_pynini.pyx":610
 *       An FST copy.
 *     """
 *     cdef Fst result = self.copy()             # <<<<<<<<<<<<<<
 *     Closure(result._mfst.get(), CLOSURE_STAR)
 *     result._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 610, __pyx_L1_error)
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->copy(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":611
 *     """
 *     cdef Fst result = self.copy()
 *     Closure(result._mfst.get(), CLOSURE_STAR)             # <<<<<<<<<<<<<<
 *     result._check_mutating_imethod()
 *     return result
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 611, __pyx_L1_error)
  }
  fst::script::Closure(__pyx_v_result->__pyx_base.__pyx_base._mfst.get(), fst::CLOSURE_STAR);

  /* "_pynini.pyx":612
 *     cdef Fst result = self.copy()
 *     Closure(result._mfst.get(), CLOSURE_STAR)
 *     result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod");
    __PYX_ERR(0, 612, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 612, __pyx_L1_error)

  /* "_pynini.pyx":613
 *     Closure(result._mfst.get(), CLOSURE_STAR)
 *     result._check_mutating_imethod()
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   def concat(self, fst2):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":601
 * 
 *   @property
 *   def star(self):             # <<<<<<<<<<<<<<
 *     """
 *     star(self)
 */

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

/* "_pynini.pyx":615
 *     return result
 * 
 *   def concat(self, fst2):             # <<<<<<<<<<<<<<
 *     """
 *     concat(self, fst2)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_19concat(PyObject *__pyx_v_self, PyObject *__pyx_v_fst2); /*proto*/
static char __pyx_doc_7_pynini_3Fst_18concat[] = "\n    concat(self, fst2)\n\n    Computes the concatenation (product) of two FSTs.\n\n    This operation destructively concatenates the FST with a second FST. If A\n    transduces string x to y with weight a and B transduces string w to v with\n    weight b, then their concatenation transduces string xw to yv with weight\n    a \\otimes b.\n\n    Args:\n      fst2: The second input FST.\n\n    Returns:\n      self.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_19concat(PyObject *__pyx_v_self, PyObject *__pyx_v_fst2) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("concat (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_18concat(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), ((PyObject *)__pyx_v_fst2));

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

static PyObject *__pyx_pf_7_pynini_3Fst_18concat(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_fst2) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_7_pynini__compile_or_copy_Fst __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("concat", 0);

  /* "_pynini.pyx":632
 *       self.
 *     """
 *     cdef Fst _fst2 = _compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *     return super().concat(_fst2)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 632, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.arc_type = __pyx_t_1;
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst2, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":633
 *     """
 *     cdef Fst _fst2 = _compile_or_copy_Fst(fst2, self.arc_type())
 *     return super().concat(_fst2)             # <<<<<<<<<<<<<<
 * 
 *   cdef void _optimize(self, bool compute_props=False) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7_pynini_Fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7_pynini_Fst));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7_pynini_Fst));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_concat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __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 && 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, ((PyObject *)__pyx_v__fst2)) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v__fst2));
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":615
 *     return result
 * 
 *   def concat(self, fst2):             # <<<<<<<<<<<<<<
 *     """
 *     concat(self, fst2)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini.Fst.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":635
 *     return super().concat(_fst2)
 * 
 *   cdef void _optimize(self, bool compute_props=False) except *:             # <<<<<<<<<<<<<<
 *     Optimize(self._mfst.get(), compute_props)
 *     self._check_mutating_imethod()
 */

static void __pyx_f_7_pynini_3Fst__optimize(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, struct __pyx_opt_args_7_pynini_3Fst__optimize *__pyx_optional_args) {
  bool __pyx_v_compute_props = ((bool)0);
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_optimize", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_compute_props = __pyx_optional_args->compute_props;
    }
  }

  /* "_pynini.pyx":636
 * 
 *   cdef void _optimize(self, bool compute_props=False) except *:
 *     Optimize(self._mfst.get(), compute_props)             # <<<<<<<<<<<<<<
 *     self._check_mutating_imethod()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 636, __pyx_L1_error)
  }
  fst::script::Optimize(__pyx_v_self->__pyx_base.__pyx_base._mfst.get(), __pyx_v_compute_props);

  /* "_pynini.pyx":637
 *   cdef void _optimize(self, bool compute_props=False) except *:
 *     Optimize(self._mfst.get(), compute_props)
 *     self._check_mutating_imethod()             # <<<<<<<<<<<<<<
 * 
 *   def optimize(self, bool compute_props=False):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mutating_imethod");
    __PYX_ERR(0, 637, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_self)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L1_error)

  /* "_pynini.pyx":635
 *     return super().concat(_fst2)
 * 
 *   cdef void _optimize(self, bool compute_props=False) except *:             # <<<<<<<<<<<<<<
 *     Optimize(self._mfst.get(), compute_props)
 *     self._check_mutating_imethod()
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.Fst._optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_pynini.pyx":639
 *     self._check_mutating_imethod()
 * 
 *   def optimize(self, bool compute_props=False):             # <<<<<<<<<<<<<<
 *     """
 *     optimize(self, compute_props=False)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_21optimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_3Fst_20optimize[] = "\n    optimize(self, compute_props=False)\n\n    Performs a generic optimization of the FST.\n\n    This operation destructively optimizes the FST, producing an equivalent\n    FST while heuristically reducing the number of states. The algorithm is\n    as follows:\n\n    * If the FST is not (known to be) epsilon-free, perform epsilon-removal.\n    * Combine identically labeled multi-arcs and sum their weights.\n    * If the FST does not have idempotent weights, halt.\n    * If the FST is not (known to be) deterministic:\n      - If the FST is a (known) acceptor:\n        * If the FST is not (known to be) unweighted and/or acyclic, encode\n          weights.\n      - Otherwise, encode labels and, if the FST is not (known to be)\n        unweighted, encode weights.\n      - Determinize the FST.\n    * Minimize the FST.\n    * If the FST was previously encoded, decode it, and combine\n      identically-labeled multi-arcs and sum their weights.\n\n    This optimization generally reduces the number of states and arcs, and may\n    also result in faster composition. However, determinization, a prerequisite\n    for minimization, may in the worst case trigger an exponential blowup in\n    the number of states. Judicious use of optimization is something of a black\n    art, but one is generally encouraged to optimize final forms of rules\n    or cascades thereof.\n\n    Args:\n      compute_props: Should unknown FST properties be computed to help choose\n          appropriate optimizations?\n\n    Returns:\n      self.\n    ";
static PyObject *__pyx_pw_7_pynini_3Fst_21optimize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  bool __pyx_v_compute_props;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("optimize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_compute_props,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_compute_props);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "optimize") < 0)) __PYX_ERR(0, 639, __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;
      }
    }
    if (values[0]) {
      __pyx_v_compute_props = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_compute_props == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L3_error)
    } else {
      __pyx_v_compute_props = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("optimize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 639, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Fst.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Fst_20optimize(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_compute_props);

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

static PyObject *__pyx_pf_7_pynini_3Fst_20optimize(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, bool __pyx_v_compute_props) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_7_pynini_3Fst__optimize __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("optimize", 0);

  /* "_pynini.pyx":677
 *       self.
 *     """
 *     self._optimize(compute_props)             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_optimize");
    __PYX_ERR(0, 677, __pyx_L1_error)
  }
  __pyx_t_1.__pyx_n = 1;
  __pyx_t_1.compute_props = __pyx_v_compute_props;
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_optimize(__pyx_v_self, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 677, __pyx_L1_error)

  /* "_pynini.pyx":678
 *     """
 *     self._optimize(compute_props)
 *     return self             # <<<<<<<<<<<<<<
 * 
 *   def union(self, *fsts2):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "_pynini.pyx":639
 *     self._check_mutating_imethod()
 * 
 *   def optimize(self, bool compute_props=False):             # <<<<<<<<<<<<<<
 *     """
 *     optimize(self, compute_props=False)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.Fst.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":680
 *     return self
 * 
 *   def union(self, *fsts2):             # <<<<<<<<<<<<<<
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_23union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_23union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fsts2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("union (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "union", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_fsts2 = __pyx_args;
  __pyx_r = __pyx_pf_7_pynini_3Fst_22union(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), __pyx_v_fsts2);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_fsts2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_3Fst_5union_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":681
 * 
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *                            for fst2 in fsts2))
 * 
 */

static PyObject *__pyx_pf_7_pynini_3Fst_5union_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7_pynini___pyx_scope_struct_1_genexpr(__pyx_ptype_7_pynini___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 681, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct__union *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_3Fst_5union_2generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_union_locals_genexpr, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 681, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.Fst.union.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7_pynini_3Fst_5union_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_7_pynini__compile_or_copy_Fst __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 681, __pyx_L1_error)

  /* "_pynini.pyx":682
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))             # <<<<<<<<<<<<<<
 * 
 *   # Operator overloads.
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fsts2)) { __Pyx_RaiseClosureNameError("fsts2"); __PYX_ERR(0, 682, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fsts2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 682, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_fsts2; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fst2);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fst2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "_pynini.pyx":681
 * 
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *                            for fst2 in fsts2))
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 681, __pyx_L1_error) }
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
      __PYX_ERR(0, 681, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.arc_type = __pyx_t_3;
    __pyx_t_4 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_cur_scope->__pyx_v_fst2, &__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 681, __pyx_L1_error)

    /* "_pynini.pyx":682
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))             # <<<<<<<<<<<<<<
 * 
 *   # Operator overloads.
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":681
 * 
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *                            for fst2 in fsts2))
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":680
 *     return self
 * 
 *   def union(self, *fsts2):             # <<<<<<<<<<<<<<
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))
 */

static PyObject *__pyx_pf_7_pynini_3Fst_22union(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_fsts2) {
  struct __pyx_obj_7_pynini___pyx_scope_struct__union *__pyx_cur_scope;
  PyObject *__pyx_gb_7_pynini_3Fst_5union_2generator6 = 0;
  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("union", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct__union *)__pyx_tp_new_7_pynini___pyx_scope_struct__union(__pyx_ptype_7_pynini___pyx_scope_struct__union, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct__union *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 680, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_fsts2 = __pyx_v_fsts2;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fsts2);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fsts2);

  /* "_pynini.pyx":681
 * 
 *   def union(self, *fsts2):
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())             # <<<<<<<<<<<<<<
 *                            for fst2 in fsts2))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7_pynini_Fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7_pynini_Fst));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7_pynini_Fst));
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __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_union); 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_t_2 = __pyx_pf_7_pynini_3Fst_5union_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":680
 *     return self
 * 
 *   def union(self, *fsts2):             # <<<<<<<<<<<<<<
 *     return super().union(*(_compile_or_copy_Fst(fst2, self.arc_type())
 *                            for fst2 in fsts2))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini.Fst.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_7_pynini_3Fst_5union_2generator6);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":686
 *   # Operator overloads.
 * 
 *   def __eq__(self, other):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_25__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_25__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_24__eq__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_24__eq__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "_pynini.pyx":689
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(self, other)             # <<<<<<<<<<<<<<
 *     return equal(_fst1, _fst2)
 * 
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(((PyObject *)__pyx_v_self), __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 689, __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, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __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, 689, __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, 689, __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, 689, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 689, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 689, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":690
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(self, other)
 *     return equal(_fst1, _fst2)             # <<<<<<<<<<<<<<
 * 
 *   def __ne__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_10_pywrapfst_equal(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst1), ((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst2), 0, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":686
 *   # Operator overloads.
 * 
 *   def __eq__(self, other):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

  /* 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("_pynini.Fst.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":692
 *     return equal(_fst1, _fst2)
 * 
 *   def __ne__(self, other):             # <<<<<<<<<<<<<<
 *     return not self == other
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_27__ne__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_27__ne__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_26__ne__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_26__ne__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other) {
  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("__ne__", 0);

  /* "_pynini.pyx":693
 * 
 *   def __ne__(self, other):
 *     return not self == other             # <<<<<<<<<<<<<<
 * 
 *   def __add__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self), __pyx_v_other, 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;
  __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":692
 *     return equal(_fst1, _fst2)
 * 
 *   def __ne__(self, other):             # <<<<<<<<<<<<<<
 *     return not self == other
 * 
 */

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

/* "_pynini.pyx":695
 *     return not self == other
 * 
 *   def __add__(self, other):             # <<<<<<<<<<<<<<
 *     return concat(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_29__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_29__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_28__add__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_28__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("__add__", 0);

  /* "_pynini.pyx":696
 * 
 *   def __add__(self, other):
 *     return concat(self, other)             # <<<<<<<<<<<<<<
 * 
 *   def __iadd__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_concat(__pyx_v_self, __pyx_v_other, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":695
 *     return not self == other
 * 
 *   def __add__(self, other):             # <<<<<<<<<<<<<<
 *     return concat(self, other)
 * 
 */

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

/* "_pynini.pyx":698
 *     return concat(self, other)
 * 
 *   def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *     return self.concat(other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_31__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_31__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_30__iadd__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_30__iadd__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other) {
  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("__iadd__", 0);

  /* "_pynini.pyx":699
 * 
 *   def __iadd__(self, other):
 *     return self.concat(other)             # <<<<<<<<<<<<<<
 * 
 *   def __sub__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_concat); 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_v_other) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_other);
  __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;

  /* "_pynini.pyx":698
 *     return concat(self, other)
 * 
 *   def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *     return self.concat(other)
 * 
 */

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

/* "_pynini.pyx":701
 *     return self.concat(other)
 * 
 *   def __sub__(self, other):             # <<<<<<<<<<<<<<
 *     return difference(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_33__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_33__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_32__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_32__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "_pynini.pyx":702
 * 
 *   def __sub__(self, other):
 *     return difference(self, other)             # <<<<<<<<<<<<<<
 * 
 *   # __isub__ is not implemented separately because difference is not an
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_difference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 702, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 702, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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, 702, __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_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_other);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __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;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":701
 *     return self.concat(other)
 * 
 *   def __sub__(self, other):             # <<<<<<<<<<<<<<
 *     return difference(self, other)
 * 
 */

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

/* "_pynini.pyx":707
 *   # in-place operation.
 * 
 *   def __pow__(self, other, modulo):             # <<<<<<<<<<<<<<
 *     """Constructively generates the range-concatenation of the FST.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_35__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo); /*proto*/
static char __pyx_doc_7_pynini_3Fst_34__pow__[] = "Constructively generates the range-concatenation of the FST.\n\n    For all natural numbers n, `f ** n` is the same as `f ** (n, n).\n    Note that `f ** (0, ...)` is the same as `f.star`,\n    `f ** (1, ...)` is `f.plus`,\n    `f ** (0, 1)` is the same as `f.ques`.\n    and `f ** (5, ...)` is the obvious generalization.\n    ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7_pynini_3Fst_34__pow__;
#endif
static PyObject *__pyx_pw_7_pynini_3Fst_35__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pow__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_34__pow__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_modulo));

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

static PyObject *__pyx_pf_7_pynini_3Fst_34__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo) {
  PyObject *__pyx_v_lower = NULL;
  PyObject *__pyx_v_upper = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pow__", 0);

  /* "_pynini.pyx":716
 *     and `f ** (5, ...)` is the obvious generalization.
 *     """
 *     if not isinstance(self, Fst) or modulo is not None:             # <<<<<<<<<<<<<<
 *       return NotImplemented
 *     if isinstance(other, int):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_7_pynini_Fst); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_modulo != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "_pynini.pyx":717
 *     """
 *     if not isinstance(self, Fst) or modulo is not None:
 *       return NotImplemented             # <<<<<<<<<<<<<<
 *     if isinstance(other, int):
 *       return closure(self, other, other)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;

    /* "_pynini.pyx":716
 *     and `f ** (5, ...)` is the obvious generalization.
 *     """
 *     if not isinstance(self, Fst) or modulo is not None:             # <<<<<<<<<<<<<<
 *       return NotImplemented
 *     if isinstance(other, int):
 */
  }

  /* "_pynini.pyx":718
 *     if not isinstance(self, Fst) or modulo is not None:
 *       return NotImplemented
 *     if isinstance(other, int):             # <<<<<<<<<<<<<<
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":719
 *       return NotImplemented
 *     if isinstance(other, int):
 *       return closure(self, other, other)             # <<<<<<<<<<<<<<
 *     if isinstance(other, tuple):
 *       try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_closure); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_self, __pyx_v_other, __pyx_v_other};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_self, __pyx_v_other, __pyx_v_other};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 719, __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_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_self);
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_other);
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_other);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "_pynini.pyx":718
 *     if not isinstance(self, Fst) or modulo is not None:
 *       return NotImplemented
 *     if isinstance(other, int):             # <<<<<<<<<<<<<<
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):
 */
  }

  /* "_pynini.pyx":720
 *     if isinstance(other, int):
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):             # <<<<<<<<<<<<<<
 *       try:
 *         (lower, upper) = other
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":721
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):
 *       try:             # <<<<<<<<<<<<<<
 *         (lower, upper) = other
 *       except ValueError:
 */
    {
      __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:*/ {

        /* "_pynini.pyx":722
 *     if isinstance(other, tuple):
 *       try:
 *         (lower, upper) = other             # <<<<<<<<<<<<<<
 *       except ValueError:
 *           raise ValueError("Expected tuple of length two")
 */
        if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
          PyObject* sequence = __pyx_v_other;
          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, 722, __pyx_L8_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, 722, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 722, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          Py_ssize_t index = -1;
          __pyx_t_8 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 722, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext;
          index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L14_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_8), 2) < 0) __PYX_ERR(0, 722, __pyx_L8_error)
          __pyx_t_12 = NULL;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L15_unpacking_done;
          __pyx_L14_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_12 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 722, __pyx_L8_error)
          __pyx_L15_unpacking_done:;
        }
        __pyx_v_lower = __pyx_t_4;
        __pyx_t_4 = 0;
        __pyx_v_upper = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "_pynini.pyx":721
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):
 *       try:             # <<<<<<<<<<<<<<
 *         (lower, upper) = other
 *       except ValueError:
 */
      }
      __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_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "_pynini.pyx":723
 *       try:
 *         (lower, upper) = other
 *       except ValueError:             # <<<<<<<<<<<<<<
 *           raise ValueError("Expected tuple of length two")
 *       if lower is Ellipsis:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("_pynini.Fst.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_8) < 0) __PYX_ERR(0, 723, __pyx_L10_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_8);

        /* "_pynini.pyx":724
 *         (lower, upper) = other
 *       except ValueError:
 *           raise ValueError("Expected tuple of length two")             # <<<<<<<<<<<<<<
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")
 */
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L10_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 724, __pyx_L10_except_error)
      }
      goto __pyx_L10_except_error;
      __pyx_L10_except_error:;

      /* "_pynini.pyx":721
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):
 *       try:             # <<<<<<<<<<<<<<
 *         (lower, upper) = other
 *       except ValueError:
 */
      __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_L13_try_end:;
    }

    /* "_pynini.pyx":725
 *       except ValueError:
 *           raise ValueError("Expected tuple of length two")
 *       if lower is Ellipsis:             # <<<<<<<<<<<<<<
 *         raise TypeError("The lower bound must be an integer")
 *       elif upper is Ellipsis:
 */
    __pyx_t_1 = (__pyx_v_lower == __pyx_builtin_Ellipsis);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (unlikely(__pyx_t_2)) {

      /* "_pynini.pyx":726
 *           raise ValueError("Expected tuple of length two")
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")             # <<<<<<<<<<<<<<
 *       elif upper is Ellipsis:
 *         return closure(self, lower)
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 726, __pyx_L1_error)

      /* "_pynini.pyx":725
 *       except ValueError:
 *           raise ValueError("Expected tuple of length two")
 *       if lower is Ellipsis:             # <<<<<<<<<<<<<<
 *         raise TypeError("The lower bound must be an integer")
 *       elif upper is Ellipsis:
 */
    }

    /* "_pynini.pyx":727
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")
 *       elif upper is Ellipsis:             # <<<<<<<<<<<<<<
 *         return closure(self, lower)
 *       else:
 */
    __pyx_t_2 = (__pyx_v_upper == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "_pynini.pyx":728
 *         raise TypeError("The lower bound must be an integer")
 *       elif upper is Ellipsis:
 *         return closure(self, lower)             # <<<<<<<<<<<<<<
 *       else:
 *         return closure(self, lower, upper)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_closure); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_7 = 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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_lower};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_lower};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_self);
        __Pyx_GIVEREF(__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_self);
        __Pyx_INCREF(__pyx_v_lower);
        __Pyx_GIVEREF(__pyx_v_lower);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_lower);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      goto __pyx_L0;

      /* "_pynini.pyx":727
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")
 *       elif upper is Ellipsis:             # <<<<<<<<<<<<<<
 *         return closure(self, lower)
 *       else:
 */
    }

    /* "_pynini.pyx":730
 *         return closure(self, lower)
 *       else:
 *         return closure(self, lower, upper)             # <<<<<<<<<<<<<<
 *     return NotImplemented
 * 
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_closure); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_self, __pyx_v_lower, __pyx_v_upper};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_self, __pyx_v_lower, __pyx_v_upper};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_v_self);
        __Pyx_GIVEREF(__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_self);
        __Pyx_INCREF(__pyx_v_lower);
        __Pyx_GIVEREF(__pyx_v_lower);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_lower);
        __Pyx_INCREF(__pyx_v_upper);
        __Pyx_GIVEREF(__pyx_v_upper);
        PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_upper);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      goto __pyx_L0;
    }

    /* "_pynini.pyx":720
 *     if isinstance(other, int):
 *       return closure(self, other, other)
 *     if isinstance(other, tuple):             # <<<<<<<<<<<<<<
 *       try:
 *         (lower, upper) = other
 */
  }

  /* "_pynini.pyx":731
 *       else:
 *         return closure(self, lower, upper)
 *     return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *   # TODO(kbg): Cython only has support for two-argument __ipow__; see:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_builtin_NotImplemented);
  __pyx_r = __pyx_builtin_NotImplemented;
  goto __pyx_L0;

  /* "_pynini.pyx":707
 *   # in-place operation.
 * 
 *   def __pow__(self, other, modulo):             # <<<<<<<<<<<<<<
 *     """Constructively generates the range-concatenation of the FST.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_pynini.Fst.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":739
 *   # If this ever changes, implement __ipow__ in the obvious fashion.
 * 
 *   def __matmul__(self, other):             # <<<<<<<<<<<<<<
 *     return compose(self, other)
 * 
 */

/* Python wrapper */
#if PY_VERSION_HEX >= 0x03050000
static PyObject *__pyx_pw_7_pynini_3Fst_37__matmul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_37__matmul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__matmul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_36__matmul__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_VERSION_HEX >= 0x03050000)*/

#if PY_VERSION_HEX >= 0x03050000
static PyObject *__pyx_pf_7_pynini_3Fst_36__matmul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__matmul__", 0);

  /* "_pynini.pyx":740
 * 
 *   def __matmul__(self, other):
 *     return compose(self, other)             # <<<<<<<<<<<<<<
 * 
 *   # __imatmul__ is not implemented separately because composition is not an
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 740, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 740, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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, 740, __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_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_other);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __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;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":739
 *   # If this ever changes, implement __ipow__ in the obvious fashion.
 * 
 *   def __matmul__(self, other):             # <<<<<<<<<<<<<<
 *     return compose(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.Fst.__matmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_VERSION_HEX >= 0x03050000)*/

/* "_pynini.pyx":745
 *   # in-place operation.
 * 
 *   def __or__(self, other):             # <<<<<<<<<<<<<<
 *     return union(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_39__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_39__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__or__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_38__or__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_38__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__or__", 0);

  /* "_pynini.pyx":746
 * 
 *   def __or__(self, other):
 *     return union(self, other)             # <<<<<<<<<<<<<<
 * 
 *   def __ior__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 746, __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[3] = {__pyx_t_3, __pyx_v_self, __pyx_v_other};
    __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, 746, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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, 746, __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_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_other);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __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;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":745
 *   # in-place operation.
 * 
 *   def __or__(self, other):             # <<<<<<<<<<<<<<
 *     return union(self, other)
 * 
 */

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

/* "_pynini.pyx":748
 *     return union(self, other)
 * 
 *   def __ior__(self, other):             # <<<<<<<<<<<<<<
 *     return self.union(other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Fst_41__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Fst_41__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ior__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Fst_40__ior__(((struct __pyx_obj_7_pynini_Fst *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7_pynini_3Fst_40__ior__(struct __pyx_obj_7_pynini_Fst *__pyx_v_self, PyObject *__pyx_v_other) {
  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("__ior__", 0);

  /* "_pynini.pyx":749
 * 
 *   def __ior__(self, other):
 *     return self.union(other)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __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_other) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_other);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __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;

  /* "_pynini.pyx":748
 *     return union(self, other)
 * 
 *   def __ior__(self, other):             # <<<<<<<<<<<<<<
 *     return self.union(other)
 * 
 */

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

/* "_pynini.pyx":756
 * 
 * 
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):             # <<<<<<<<<<<<<<
 *   if not isinstance(arg, Fst):
 *     return accep(arg, arc_type=arc_type)
 */

static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__compile_or_copy_Fst(PyObject *__pyx_v_arg, struct __pyx_opt_args_7_pynini__compile_or_copy_Fst *__pyx_optional_args) {
  PyObject *__pyx_v_arc_type = ((PyObject *)__pyx_n_u_standard);
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compile_or_copy_Fst", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_arc_type = __pyx_optional_args->arc_type;
    }
  }

  /* "_pynini.pyx":757
 * 
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):
 *   if not isinstance(arg, Fst):             # <<<<<<<<<<<<<<
 *     return accep(arg, arc_type=arc_type)
 *   else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_ptype_7_pynini_Fst); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":758
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):
 *   if not isinstance(arg, Fst):
 *     return accep(arg, arc_type=arc_type)             # <<<<<<<<<<<<<<
 *   else:
 *     return arg.copy()
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_accep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arg);
    __Pyx_GIVEREF(__pyx_v_arg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arg);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_arc_type, __pyx_v_arc_type) < 0) __PYX_ERR(0, 758, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 758, __pyx_L1_error)
    __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "_pynini.pyx":757
 * 
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):
 *   if not isinstance(arg, Fst):             # <<<<<<<<<<<<<<
 *     return accep(arg, arc_type=arc_type)
 *   else:
 */
  }

  /* "_pynini.pyx":760
 *     return accep(arg, arc_type=arc_type)
 *   else:
 *     return arg.copy()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 760, __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_6 = (__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_6)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 760, __pyx_L1_error)
    __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "_pynini.pyx":756
 * 
 * 
 * cdef Fst _compile_or_copy_Fst(arg, arc_type="standard"):             # <<<<<<<<<<<<<<
 *   if not isinstance(arg, Fst):
 *     return accep(arg, arc_type=arc_type)
 */

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

/* "_pynini.pyx":767
 * 
 * 
 * cdef object _compile_or_copy_two_Fsts(fst1, fst2):             # <<<<<<<<<<<<<<
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 */

static PyObject *__pyx_f_7_pynini__compile_or_copy_two_Fsts(PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_7_pynini__compile_or_copy_Fst __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compile_or_copy_two_Fsts", 0);

  /* "_pynini.pyx":770
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   if isinstance(fst1, Fst):             # <<<<<<<<<<<<<<
 *     _fst1 = fst1.copy()
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_fst1, __pyx_ptype_7_pynini_Fst); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":771
 *   cdef Fst _fst2
 *   if isinstance(fst1, Fst):
 *     _fst1 = fst1.copy()             # <<<<<<<<<<<<<<
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 *   elif isinstance(fst2, Fst):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fst1, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __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_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, 771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 771, __pyx_L1_error)
    __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "_pynini.pyx":772
 *   if isinstance(fst1, Fst):
 *     _fst1 = fst1.copy()
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())             # <<<<<<<<<<<<<<
 *   elif isinstance(fst2, Fst):
 *     _fst2 = fst2.copy()
 */
    if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
      __PYX_ERR(0, 772, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst1), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.arc_type = __pyx_t_3;
    __pyx_t_4 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst2, &__pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "_pynini.pyx":770
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   if isinstance(fst1, Fst):             # <<<<<<<<<<<<<<
 *     _fst1 = fst1.copy()
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":773
 *     _fst1 = fst1.copy()
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 *   elif isinstance(fst2, Fst):             # <<<<<<<<<<<<<<
 *     _fst2 = fst2.copy()
 *     _fst1 = accep(fst1, arc_type=_fst2.arc_type())
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_fst2, __pyx_ptype_7_pynini_Fst); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":774
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 *   elif isinstance(fst2, Fst):
 *     _fst2 = fst2.copy()             # <<<<<<<<<<<<<<
 *     _fst1 = accep(fst1, arc_type=_fst2.arc_type())
 *   else:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fst2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __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_4 = (__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_4)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 774, __pyx_L1_error)
    __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "_pynini.pyx":775
 *   elif isinstance(fst2, Fst):
 *     _fst2 = fst2.copy()
 *     _fst1 = accep(fst1, arc_type=_fst2.arc_type())             # <<<<<<<<<<<<<<
 *   else:
 *     _fst1 = accep(fst1)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_accep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_fst1);
    __Pyx_GIVEREF(__pyx_v_fst1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fst1);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
      __PYX_ERR(0, 775, __pyx_L1_error)
    }
    __pyx_t_7 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst2->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst2), 0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_arc_type, __pyx_t_7) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 775, __pyx_L1_error)
    __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "_pynini.pyx":773
 *     _fst1 = fst1.copy()
 *     _fst2 = _compile_or_copy_Fst(fst2, _fst1.arc_type())
 *   elif isinstance(fst2, Fst):             # <<<<<<<<<<<<<<
 *     _fst2 = fst2.copy()
 *     _fst1 = accep(fst1, arc_type=_fst2.arc_type())
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":777
 *     _fst1 = accep(fst1, arc_type=_fst2.arc_type())
 *   else:
 *     _fst1 = accep(fst1)             # <<<<<<<<<<<<<<
 *     _fst2 = accep(fst2)
 *   return (_fst1, _fst2)
 */
  /*else*/ {
    __pyx_t_7 = ((PyObject *)__pyx_f_7_pynini_accep(__pyx_v_fst1, 0, NULL)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "_pynini.pyx":778
 *   else:
 *     _fst1 = accep(fst1)
 *     _fst2 = accep(fst2)             # <<<<<<<<<<<<<<
 *   return (_fst1, _fst2)
 * 
 */
    __pyx_t_7 = ((PyObject *)__pyx_f_7_pynini_accep(__pyx_v_fst2, 0, NULL)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L3:;

  /* "_pynini.pyx":779
 *     _fst1 = accep(fst1)
 *     _fst2 = accep(fst2)
 *   return (_fst1, _fst2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst1));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v__fst1));
  __Pyx_INCREF(((PyObject *)__pyx_v__fst2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst2));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v__fst2));
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":767
 * 
 * 
 * cdef object _compile_or_copy_two_Fsts(fst1, fst2):             # <<<<<<<<<<<<<<
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("_pynini._compile_or_copy_two_Fsts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":786
 * 
 * 
 * cdef Fst _init_Fst_from_MutableFst(_MutableFst fst):             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._fst = fst._fst
 */

static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__init_Fst_from_MutableFst(struct __pyx_obj_10_pywrapfst_MutableFst *__pyx_v_fst) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::shared_ptr<fst::script::FstClass>  __pyx_t_2;
  std::shared_ptr<fst::script::MutableFstClass>  __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_Fst_from_MutableFst", 0);

  /* "_pynini.pyx":787
 * 
 * cdef Fst _init_Fst_from_MutableFst(_MutableFst fst):
 *   cdef Fst result = Fst.__new__(Fst)             # <<<<<<<<<<<<<<
 *   result._fst = fst._fst
 *   result._mfst = fst._mfst
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_Fst(((PyTypeObject *)__pyx_ptype_7_pynini_Fst), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":788
 * cdef Fst _init_Fst_from_MutableFst(_MutableFst fst):
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._fst = fst._fst             # <<<<<<<<<<<<<<
 *   result._mfst = fst._mfst
 *   return result
 */
  if (unlikely(((PyObject *)__pyx_v_fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 788, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_fst->__pyx_base._fst;
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 788, __pyx_L1_error)
  }
  __pyx_v_result->__pyx_base.__pyx_base.__pyx_base._fst = __pyx_t_2;

  /* "_pynini.pyx":789
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._fst = fst._fst
 *   result._mfst = fst._mfst             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 789, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_fst->_mfst;
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 789, __pyx_L1_error)
  }
  __pyx_v_result->__pyx_base.__pyx_base._mfst = __pyx_t_3;

  /* "_pynini.pyx":790
 *   result._fst = fst._fst
 *   result._mfst = fst._mfst
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":786
 * 
 * 
 * cdef Fst _init_Fst_from_MutableFst(_MutableFst fst):             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._fst = fst._fst
 */

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

/* "_pynini.pyx":796
 * 
 * 
 * cpdef Fst _from_pywrapfst(_Fst fst):             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._from_MutableFstClass(new VectorFstClass(deref(fst._fst)))
 */

static PyObject *__pyx_pw_7_pynini_1_from_pywrapfst(PyObject *__pyx_self, PyObject *__pyx_v_fst); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__from_pywrapfst(struct __pyx_obj_10_pywrapfst_Fst *__pyx_v_fst, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_from_pywrapfst", 0);

  /* "_pynini.pyx":797
 * 
 * cpdef Fst _from_pywrapfst(_Fst fst):
 *   cdef Fst result = Fst.__new__(Fst)             # <<<<<<<<<<<<<<
 *   result._from_MutableFstClass(new VectorFstClass(deref(fst._fst)))
 *   return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_Fst(((PyTypeObject *)__pyx_ptype_7_pynini_Fst), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":798
 * cpdef Fst _from_pywrapfst(_Fst fst):
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._from_MutableFstClass(new VectorFstClass(deref(fst._fst)))             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_from_MutableFstClass");
    __PYX_ERR(0, 798, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 798, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_from_MutableFstClass(__pyx_v_result, new fst::script::VectorFstClass((*__pyx_v_fst->_fst)));

  /* "_pynini.pyx":799
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._from_MutableFstClass(new VectorFstClass(deref(fst._fst)))
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":796
 * 
 * 
 * cpdef Fst _from_pywrapfst(_Fst fst):             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst.__new__(Fst)
 *   result._from_MutableFstClass(new VectorFstClass(deref(fst._fst)))
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_1_from_pywrapfst(PyObject *__pyx_self, PyObject *__pyx_v_fst); /*proto*/
static PyObject *__pyx_pw_7_pynini_1_from_pywrapfst(PyObject *__pyx_self, PyObject *__pyx_v_fst) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_from_pywrapfst (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fst), __pyx_ptype_10_pywrapfst_Fst, 1, "fst", 0))) __PYX_ERR(0, 796, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini__from_pywrapfst(__pyx_self, ((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_fst));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini__from_pywrapfst(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10_pywrapfst_Fst *__pyx_v_fst) {
  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("_from_pywrapfst", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__from_pywrapfst(__pyx_v_fst, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":802
 * 
 * 
 * cpdef Fst _read(filename):             # <<<<<<<<<<<<<<
 *   return _from_pywrapfst(_pywrapfst.Fst.read(filename))
 * 
 */

static PyObject *__pyx_pw_7_pynini_3_read(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__read(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__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("_read", 0);

  /* "_pynini.pyx":803
 * 
 * cpdef Fst _read(filename):
 *   return _from_pywrapfst(_pywrapfst.Fst.read(filename))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Fst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __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_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __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_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_filename);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_Fst))))) __PYX_ERR(0, 803, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__from_pywrapfst(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":802
 * 
 * 
 * cpdef Fst _read(filename):             # <<<<<<<<<<<<<<
 *   return _from_pywrapfst(_pywrapfst.Fst.read(filename))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini._read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3_read(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static PyObject *__pyx_pw_7_pynini_3_read(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_2_read(__pyx_self, ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_2_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  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("_read", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__read(__pyx_v_filename, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":806
 * 
 * 
 * cpdef Fst _read_from_string(state):             # <<<<<<<<<<<<<<
 *   return _from_pywrapfst(_pywrapfst.Fst.read_from_string(state))
 * 
 */

static PyObject *__pyx_pw_7_pynini_5_read_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini__read_from_string(PyObject *__pyx_v_state, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__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("_read_from_string", 0);

  /* "_pynini.pyx":807
 * 
 * cpdef Fst _read_from_string(state):
 *   return _from_pywrapfst(_pywrapfst.Fst.read_from_string(state))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Fst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __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_read_from_string_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __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_v_state) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_state);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_Fst))))) __PYX_ERR(0, 807, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__from_pywrapfst(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":806
 * 
 * 
 * cpdef Fst _read_from_string(state):             # <<<<<<<<<<<<<<
 *   return _from_pywrapfst(_pywrapfst.Fst.read_from_string(state))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini._read_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_5_read_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_5_read_from_string(PyObject *__pyx_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read_from_string (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_4_read_from_string(__pyx_self, ((PyObject *)__pyx_v_state));

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

static PyObject *__pyx_pf_7_pynini_4_read_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state) {
  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("_read_from_string", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__read_from_string(__pyx_v_state, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":813
 * 
 * 
 * cpdef string escape(data):             # <<<<<<<<<<<<<<
 *   """
 *   escape(data)
 */

static PyObject *__pyx_pw_7_pynini_7escape(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
static std::string __pyx_f_7_pynini_escape(PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("escape", 0);

  /* "_pynini.pyx":830
 *     An escaped string.
 *   """
 *   return Escape(tostring(data))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_10_pywrapfst_tostring(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L1_error)
  __pyx_r = fst::Escape(__pyx_t_1);
  goto __pyx_L0;

  /* "_pynini.pyx":813
 * 
 * 
 * cpdef string escape(data):             # <<<<<<<<<<<<<<
 *   """
 *   escape(data)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_pynini.escape", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_7escape(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_7_pynini_6escape[] = "\n  escape(data)\n\n  Escape all characters in a string that can be used to generate symbols.\n\n  This function returns a new string which backslash-escapes the opening and\n  closing square bracket characters as well as backslashes to allow the passing\n  of arbitrary strings into Pynini functions without worrying about string\n  compilation errors.\n\n  Args:\n    data: The input string.\n\n  Returns:\n    An escaped string.\n  ";
static PyObject *__pyx_pw_7_pynini_7escape(PyObject *__pyx_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("escape (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_6escape(__pyx_self, ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_7_pynini_6escape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data) {
  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("escape", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_7_pynini_escape(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":836
 * 
 * 
 * cpdef Fst accep(astring, weight=None, arc_type="standard", token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   accep(astring, weight=None, arc_type=None, token_type=None)
 */

static PyObject *__pyx_pw_7_pynini_9accep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_accep(PyObject *__pyx_v_astring, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_accep *__pyx_optional_args) {
  PyObject *__pyx_v_weight = ((PyObject *)Py_None);
  PyObject *__pyx_v_arc_type = ((PyObject *)__pyx_n_u_standard);
  PyObject *__pyx_v_token_type = ((PyObject *)Py_None);
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  fst::script::WeightClass __pyx_v__weight;
  fst::TokenType __pyx_v__token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__symbols;
  bool __pyx_v_success;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  fst::script::WeightClass __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  fst::SymbolTable const *__pyx_t_6;
  std::string __pyx_t_7;
  fst::TokenType __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accep", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_weight = __pyx_optional_args->weight;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_arc_type = __pyx_optional_args->arc_type;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_token_type = __pyx_optional_args->token_type;
        }
      }
    }
  }

  /* "_pynini.pyx":869
 *       FstStringCompilationError: String compilation failed.
 *   """
 *   cdef Fst result = Fst(arc_type)             # <<<<<<<<<<<<<<
 *   cdef WeightClass _weight = _get_WeightClass_or_one(result.weight_type(),
 *                                                      weight)
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_v_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":870
 *   """
 *   cdef Fst result = Fst(arc_type)
 *   cdef WeightClass _weight = _get_WeightClass_or_one(result.weight_type(),             # <<<<<<<<<<<<<<
 *                                                      weight)
 *   cdef _TokenType _token_type
 */
  __pyx_t_2 = __pyx_f_10_pywrapfst__get_WeightClass_or_one(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.weight_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_result), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 870, __pyx_L1_error)
  __pyx_v__weight = __pyx_t_2;

  /* "_pynini.pyx":873
 *                                                      weight)
 *   cdef _TokenType _token_type
 *   cdef const_SymbolTable_ptr _symbols = NULL             # <<<<<<<<<<<<<<
 *   if token_type is None:
 *     _token_type = GetDefaultTokenType()
 */
  __pyx_v__symbols = NULL;

  /* "_pynini.pyx":874
 *   cdef _TokenType _token_type
 *   cdef const_SymbolTable_ptr _symbols = NULL
 *   if token_type is None:             # <<<<<<<<<<<<<<
 *     _token_type = GetDefaultTokenType()
 *     _symbols = GetDefaultSymbols()
 */
  __pyx_t_3 = (__pyx_v_token_type == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "_pynini.pyx":875
 *   cdef const_SymbolTable_ptr _symbols = NULL
 *   if token_type is None:
 *     _token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *     _symbols = GetDefaultSymbols()
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":876
 *   if token_type is None:
 *     _token_type = GetDefaultTokenType()
 *     _symbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *     _token_type = _TokenType.SYMBOL
 */
    __pyx_v__symbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":874
 *   cdef _TokenType _token_type
 *   cdef const_SymbolTable_ptr _symbols = NULL
 *   if token_type is None:             # <<<<<<<<<<<<<<
 *     _token_type = GetDefaultTokenType()
 *     _symbols = GetDefaultSymbols()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":877
 *     _token_type = GetDefaultTokenType()
 *     _symbols = GetDefaultSymbols()
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _token_type = _TokenType.SYMBOL
 *     _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_token_type, __pyx_t_5); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "_pynini.pyx":878
 *     _symbols = GetDefaultSymbols()
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *     _token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *     _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 *   else:
 */
    __pyx_v__token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":879
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):
 *     _token_type = _TokenType.SYMBOL
 *     _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *   else:
 *     _token_type = _get_token_type(tostring(token_type))
 */
    if (unlikely(__pyx_v_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 879, __pyx_L1_error)
    }
    __pyx_t_6 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 879, __pyx_L1_error)
    __pyx_v__symbols = __pyx_t_6;

    /* "_pynini.pyx":877
 *     _token_type = GetDefaultTokenType()
 *     _symbols = GetDefaultSymbols()
 *   elif isinstance(token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _token_type = _TokenType.SYMBOL
 *     _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":881
 *     _symbols = (<_SymbolTableView> token_type)._raw_ptr_or_raise()
 *   else:
 *     _token_type = _get_token_type(tostring(token_type))             # <<<<<<<<<<<<<<
 *   cdef bool success = StringCompile(
 *       tostring(astring),
 */
  /*else*/ {
    __pyx_t_7 = __pyx_f_10_pywrapfst_tostring(__pyx_v_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 881, __pyx_L1_error)
    __pyx_t_8 = __pyx_f_7_pynini__get_token_type(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 881, __pyx_L1_error)
    __pyx_v__token_type = __pyx_t_8;
  }
  __pyx_L3:;

  /* "_pynini.pyx":883
 *     _token_type = _get_token_type(tostring(token_type))
 *   cdef bool success = StringCompile(
 *       tostring(astring),             # <<<<<<<<<<<<<<
 *       result._mfst.get(),
 *       _token_type,
 */
  __pyx_t_7 = __pyx_f_10_pywrapfst_tostring(__pyx_v_astring); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 883, __pyx_L1_error)

  /* "_pynini.pyx":882
 *   else:
 *     _token_type = _get_token_type(tostring(token_type))
 *   cdef bool success = StringCompile(             # <<<<<<<<<<<<<<
 *       tostring(astring),
 *       result._mfst.get(),
 */
  __pyx_v_success = fst::script::StringCompile(__pyx_t_7, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), __pyx_v__token_type, __pyx_v__symbols, __pyx_v__weight);

  /* "_pynini.pyx":890
 *   # First we check whether there were problems with arc or weight type, then
 *   # for string compilation issues.
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   if not success:
 *     raise FstStringCompilationError("String compilation failed")
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 890, __pyx_L1_error)

  /* "_pynini.pyx":891
 *   # for string compilation issues.
 *   result._check_mutating_imethod()
 *   if not success:             # <<<<<<<<<<<<<<
 *     raise FstStringCompilationError("String compilation failed")
 *   return result
 */
  __pyx_t_3 = ((!(__pyx_v_success != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "_pynini.pyx":892
 *   result._check_mutating_imethod()
 *   if not success:
 *     raise FstStringCompilationError("String compilation failed")             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FstStringCompilationError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_kp_u_String_compilation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_String_compilation_failed);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 892, __pyx_L1_error)

    /* "_pynini.pyx":891
 *   # for string compilation issues.
 *   result._check_mutating_imethod()
 *   if not success:             # <<<<<<<<<<<<<<
 *     raise FstStringCompilationError("String compilation failed")
 *   return result
 */
  }

  /* "_pynini.pyx":893
 *   if not success:
 *     raise FstStringCompilationError("String compilation failed")
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":836
 * 
 * 
 * cpdef Fst accep(astring, weight=None, arc_type="standard", token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   accep(astring, weight=None, arc_type=None, token_type=None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("_pynini.accep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_9accep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_8accep[] = "\n  accep(astring, weight=None, arc_type=None, token_type=None)\n\n  Creates an acceptor from a string.\n\n  This function creates an FST which accepts its input with a fixed weight\n  (defaulting to semiring One).\n\n  Args:\n    astring: The input string.\n    weight: A Weight or weight string indicating the desired path weight. If\n        omitted or null, the path weight is set to semiring One.\n    arc_type: An optional string indicating the arc type for the compiled FST.\n        This argument is silently ignored if istring and/or ostring is already\n        compiled.\n    token_type: An optional string indicating how the input string is to be\n        encoded as arc labels---one of: \"utf8\" (encodes the strings as UTF-8\n        encoded Unicode string), \"byte\" (encodes the string as raw bytes)---or\n        a SymbolTable to be used to encode the string. If not set, or set to\n        None, the value is set to the default token_type, which begins as\n        \"byte\", but can be overridden for regions of code using the\n        default_token_type context manager.\n\n    Returns:\n      An FST.\n\n    Raises:\n      FstArgError: Unknown arc type.\n      FstArgError: Unknown token type.\n      FstOpError: Operation failed.\n      FstStringCompilationError: String compilation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_9accep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_astring = 0;
  PyObject *__pyx_v_weight = 0;
  PyObject *__pyx_v_arc_type = 0;
  PyObject *__pyx_v_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_astring,&__pyx_n_s_weight,&__pyx_n_s_arc_type,&__pyx_n_s_token_type,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_n_u_standard);
    values[3] = ((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  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_astring)) != 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_weight);
          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_arc_type);
          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_token_type);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accep") < 0)) __PYX_ERR(0, 836, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_astring = values[0];
    __pyx_v_weight = values[1];
    __pyx_v_arc_type = values[2];
    __pyx_v_token_type = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accep", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 836, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.accep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_8accep(__pyx_self, __pyx_v_astring, __pyx_v_weight, __pyx_v_arc_type, __pyx_v_token_type);

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

static PyObject *__pyx_pf_7_pynini_8accep(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_astring, PyObject *__pyx_v_weight, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_token_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_accep __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accep", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.weight = __pyx_v_weight;
  __pyx_t_2.arc_type = __pyx_v_arc_type;
  __pyx_t_2.token_type = __pyx_v_token_type;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_accep(__pyx_v_astring, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":896
 * 
 * 
 * cpdef Fst cross(fst1, fst2):             # <<<<<<<<<<<<<<
 *   """
 *   cross(fst1, fst2)
 */

static PyObject *__pyx_pw_7_pynini_11cross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_cross(PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__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("cross", 0);

  /* "_pynini.pyx":919
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   Cross(deref(_fst1._fst), deref(_fst2._fst), result._mfst.get())
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 919, __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, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 919, __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, 919, __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, 919, __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, 919, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 919, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 919, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":920
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   cdef Fst result = Fst(_fst1.arc_type())             # <<<<<<<<<<<<<<
 *   Cross(deref(_fst1._fst), deref(_fst2._fst), result._mfst.get())
 *   result._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 920, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst1), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":921
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   Cross(deref(_fst1._fst), deref(_fst2._fst), result._mfst.get())             # <<<<<<<<<<<<<<
 *   result._check_mutating_imethod()
 *   return result
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 921, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 921, __pyx_L1_error)
  }
  fst::script::Cross((*__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__fst2->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_result->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":922
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   Cross(deref(_fst1._fst), deref(_fst2._fst), result._mfst.get())
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error)

  /* "_pynini.pyx":923
 *   Cross(deref(_fst1._fst), deref(_fst2._fst), result._mfst.get())
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":896
 * 
 * 
 * cpdef Fst cross(fst1, fst2):             # <<<<<<<<<<<<<<
 *   """
 *   cross(fst1, fst2)
 */

  /* 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("_pynini.cross", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_11cross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_10cross[] = "\n  cross(fst1, fst2)\n\n  Creates a cross-product transducer.\n\n  This function creates an FST which transduces from the upper language\n  to the lower language.\n\n  Args:\n    fst1: The input string, or an acceptor FST representing the upper\n        language.\n    fst2: The output string, or an acceptor FST representing the upper\n        language.\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_11cross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cross (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,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_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cross", 1, 2, 2, 1); __PYX_ERR(0, 896, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cross") < 0)) __PYX_ERR(0, 896, __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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cross", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 896, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.cross", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_10cross(__pyx_self, __pyx_v_fst1, __pyx_v_fst2);

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

static PyObject *__pyx_pf_7_pynini_10cross(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2) {
  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("cross", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_cross(__pyx_v_fst1, __pyx_v_fst2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":926
 * 
 * 
 * cpdef Fst cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl"):             # <<<<<<<<<<<<<<
 *   """
 *   cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl")
 */

static PyObject *__pyx_pw_7_pynini_13cdrewrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_cdrewrite(PyObject *__pyx_v_tau, PyObject *__pyx_v_l, PyObject *__pyx_v_r, PyObject *__pyx_v_sigma_star, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_cdrewrite *__pyx_optional_args) {
  PyObject *__pyx_v_direction = ((PyObject *)__pyx_n_u_ltr);
  PyObject *__pyx_v_mode = ((PyObject *)__pyx_n_u_obl);
  struct __pyx_obj_7_pynini_Fst *__pyx_v__sigma_star = 0;
  std::string __pyx_v_arc_type;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__tau = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__l = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__r = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  enum fst::CDRewriteDirection __pyx_v__direction;
  enum fst::CDRewriteMode __pyx_v__mode;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_7_pynini__compile_or_copy_Fst __pyx_t_3;
  std::string __pyx_t_4;
  enum fst::CDRewriteDirection __pyx_t_5;
  enum fst::CDRewriteMode __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cdrewrite", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_direction = __pyx_optional_args->direction;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_mode = __pyx_optional_args->mode;
      }
    }
  }

  /* "_pynini.pyx":964
 *     FstOpError: Operation failed.
 *   """
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star)             # <<<<<<<<<<<<<<
 *   cdef string arc_type = _sigma_star.arc_type()
 *   cdef Fst _tau = _compile_or_copy_Fst(tau, arc_type)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_sigma_star, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__sigma_star = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":965
 *   """
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star)
 *   cdef string arc_type = _sigma_star.arc_type()             # <<<<<<<<<<<<<<
 *   cdef Fst _tau = _compile_or_copy_Fst(tau, arc_type)
 *   cdef Fst _l = _compile_or_copy_Fst(l, arc_type)
 */
  if (unlikely(((PyObject *)__pyx_v__sigma_star) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 965, __pyx_L1_error)
  }
  __pyx_v_arc_type = ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__sigma_star->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__sigma_star), 0);

  /* "_pynini.pyx":966
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star)
 *   cdef string arc_type = _sigma_star.arc_type()
 *   cdef Fst _tau = _compile_or_copy_Fst(tau, arc_type)             # <<<<<<<<<<<<<<
 *   cdef Fst _l = _compile_or_copy_Fst(l, arc_type)
 *   cdef Fst _r = _compile_or_copy_Fst(r, arc_type)
 */
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.arc_type = __pyx_t_1;
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_tau, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__tau = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":967
 *   cdef string arc_type = _sigma_star.arc_type()
 *   cdef Fst _tau = _compile_or_copy_Fst(tau, arc_type)
 *   cdef Fst _l = _compile_or_copy_Fst(l, arc_type)             # <<<<<<<<<<<<<<
 *   cdef Fst _r = _compile_or_copy_Fst(r, arc_type)
 *   cdef Fst result = Fst(arc_type)
 */
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_arc_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.arc_type = __pyx_t_2;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_l, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v__l = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":968
 *   cdef Fst _tau = _compile_or_copy_Fst(tau, arc_type)
 *   cdef Fst _l = _compile_or_copy_Fst(l, arc_type)
 *   cdef Fst _r = _compile_or_copy_Fst(r, arc_type)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(arc_type)
 *   cdef _CDRewriteDirection _direction = _get_cdrewrite_direction(tostring(
 */
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.arc_type = __pyx_t_1;
  __pyx_t_2 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_r, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":969
 *   cdef Fst _l = _compile_or_copy_Fst(l, arc_type)
 *   cdef Fst _r = _compile_or_copy_Fst(r, arc_type)
 *   cdef Fst result = Fst(arc_type)             # <<<<<<<<<<<<<<
 *   cdef _CDRewriteDirection _direction = _get_cdrewrite_direction(tostring(
 *       direction))
 */
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_arc_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_2); 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;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":970
 *   cdef Fst _r = _compile_or_copy_Fst(r, arc_type)
 *   cdef Fst result = Fst(arc_type)
 *   cdef _CDRewriteDirection _direction = _get_cdrewrite_direction(tostring(             # <<<<<<<<<<<<<<
 *       direction))
 *   cdef _CDRewriteMode _mode = _get_cdrewrite_mode(tostring(mode))
 */
  __pyx_t_4 = __pyx_f_10_pywrapfst_tostring(__pyx_v_direction); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L1_error)
  __pyx_t_5 = __pyx_f_7_pynini__get_cdrewrite_direction(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L1_error)
  __pyx_v__direction = __pyx_t_5;

  /* "_pynini.pyx":972
 *   cdef _CDRewriteDirection _direction = _get_cdrewrite_direction(tostring(
 *       direction))
 *   cdef _CDRewriteMode _mode = _get_cdrewrite_mode(tostring(mode))             # <<<<<<<<<<<<<<
 *   CDRewriteCompile(deref(_tau._fst),
 *                    deref(_l._fst),
 */
  __pyx_t_4 = __pyx_f_10_pywrapfst_tostring(__pyx_v_mode); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_7_pynini__get_cdrewrite_mode(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L1_error)
  __pyx_v__mode = __pyx_t_6;

  /* "_pynini.pyx":973
 *       direction))
 *   cdef _CDRewriteMode _mode = _get_cdrewrite_mode(tostring(mode))
 *   CDRewriteCompile(deref(_tau._fst),             # <<<<<<<<<<<<<<
 *                    deref(_l._fst),
 *                    deref(_r._fst),
 */
  if (unlikely(((PyObject *)__pyx_v__tau) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 973, __pyx_L1_error)
  }

  /* "_pynini.pyx":974
 *   cdef _CDRewriteMode _mode = _get_cdrewrite_mode(tostring(mode))
 *   CDRewriteCompile(deref(_tau._fst),
 *                    deref(_l._fst),             # <<<<<<<<<<<<<<
 *                    deref(_r._fst),
 *                    deref(_sigma_star._fst),
 */
  if (unlikely(((PyObject *)__pyx_v__l) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 974, __pyx_L1_error)
  }

  /* "_pynini.pyx":975
 *   CDRewriteCompile(deref(_tau._fst),
 *                    deref(_l._fst),
 *                    deref(_r._fst),             # <<<<<<<<<<<<<<
 *                    deref(_sigma_star._fst),
 *                    result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v__r) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 975, __pyx_L1_error)
  }

  /* "_pynini.pyx":976
 *                    deref(_l._fst),
 *                    deref(_r._fst),
 *                    deref(_sigma_star._fst),             # <<<<<<<<<<<<<<
 *                    result._mfst.get(),
 *                    _direction,
 */
  if (unlikely(((PyObject *)__pyx_v__sigma_star) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 976, __pyx_L1_error)
  }

  /* "_pynini.pyx":973
 *       direction))
 *   cdef _CDRewriteMode _mode = _get_cdrewrite_mode(tostring(mode))
 *   CDRewriteCompile(deref(_tau._fst),             # <<<<<<<<<<<<<<
 *                    deref(_l._fst),
 *                    deref(_r._fst),
 */
  fst::script::CDRewriteCompile((*__pyx_v__tau->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__l->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__r->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__sigma_star->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), __pyx_v__direction, __pyx_v__mode, fst::kBosIndex, fst::kEosIndex);

  /* "_pynini.pyx":982
 *                    kBosIndex,
 *                    kEosIndex)
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 982, __pyx_L1_error)

  /* "_pynini.pyx":983
 *                    kEosIndex)
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":926
 * 
 * 
 * cpdef Fst cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl"):             # <<<<<<<<<<<<<<
 *   """
 *   cdrewrite(tau, l, r, sigma_star, direction="ltr", mode="obl")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.cdrewrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__sigma_star);
  __Pyx_XDECREF((PyObject *)__pyx_v__tau);
  __Pyx_XDECREF((PyObject *)__pyx_v__l);
  __Pyx_XDECREF((PyObject *)__pyx_v__r);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_13cdrewrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_12cdrewrite[] = "\n  cdrewrite(tau, l, r, sigma_star, direction=\"ltr\", mode=\"obl\")\n\n  Compiles a transducer expressing a context-dependent rewrite rule.\n\n  This operation compiles a transducer representing a context-dependent\n  rewrite rule of the form\n\n      tau / L __ R\n\n  over a finite vocabulary.\n\n  There are two reserved symbols: \"[BOS]\" denotes the left edge of a string\n  within L, and \"[EOS]\" (end of string) denotes the right edge of a string\n  within R. Note that these reserved symbols do not have any special\n  interpretation anywhere else within this library.\n  \n  Args:\n    tau: A transducer representing the desired transduction tau.\n    l: An unweighted acceptor representing the left context L.\n    r: An unweighted acceptor representing the right context R.\n    sigma_star: A cyclic, unweighted acceptor representing the closure over the\n        alphabet.\n    direction: A string specifying the direction of rule application; one of:\n        \"ltr\" (left-to-right application), \"rtl\" (right-to-left application),\n        or \"sim\" (simultaneous application).\n    mode: A string specifying the mode of rule application; one of: \"obl\"\n        (obligatory application), \"opt\" (optional application).\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstArgError: Unknown cdrewrite direction type.\n    FstArgError: Unknown cdrewrite mode type.\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_13cdrewrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tau = 0;
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_v_r = 0;
  PyObject *__pyx_v_sigma_star = 0;
  PyObject *__pyx_v_direction = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cdrewrite (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tau,&__pyx_n_s_l,&__pyx_n_s_r,&__pyx_n_s_sigma_star,&__pyx_n_s_direction,&__pyx_n_s_mode,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_n_u_ltr);
    values[5] = ((PyObject *)__pyx_n_u_obl);
    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_tau)) != 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_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cdrewrite", 0, 4, 6, 1); __PYX_ERR(0, 926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cdrewrite", 0, 4, 6, 2); __PYX_ERR(0, 926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_star)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cdrewrite", 0, 4, 6, 3); __PYX_ERR(0, 926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_direction);
          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_mode);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cdrewrite") < 0)) __PYX_ERR(0, 926, __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);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_tau = values[0];
    __pyx_v_l = values[1];
    __pyx_v_r = values[2];
    __pyx_v_sigma_star = values[3];
    __pyx_v_direction = values[4];
    __pyx_v_mode = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cdrewrite", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.cdrewrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_12cdrewrite(__pyx_self, __pyx_v_tau, __pyx_v_l, __pyx_v_r, __pyx_v_sigma_star, __pyx_v_direction, __pyx_v_mode);

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

static PyObject *__pyx_pf_7_pynini_12cdrewrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tau, PyObject *__pyx_v_l, PyObject *__pyx_v_r, PyObject *__pyx_v_sigma_star, PyObject *__pyx_v_direction, PyObject *__pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_cdrewrite __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cdrewrite", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.direction = __pyx_v_direction;
  __pyx_t_2.mode = __pyx_v_mode;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_cdrewrite(__pyx_v_tau, __pyx_v_l, __pyx_v_r, __pyx_v_sigma_star, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":986
 * 
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",             # <<<<<<<<<<<<<<
 *                             bool connect=True):
 *   """
 */

static PyObject *__pyx_pw_7_pynini_15leniently_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_leniently_compose(PyObject *__pyx_v_mu, PyObject *__pyx_v_nu, PyObject *__pyx_v_sigma_star, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_leniently_compose *__pyx_optional_args) {
  PyObject *__pyx_v_compose_filter = ((PyObject *)__pyx_n_u_auto);

  /* "_pynini.pyx":987
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",
 *                             bool connect=True):             # <<<<<<<<<<<<<<
 *   """
 *   leniently_compose(mu, nu, sigma_star, compose_filter="auto", connect=True)
 */
  bool __pyx_v_connect = ((bool)1);
  struct __pyx_obj_7_pynini_Fst *__pyx_v__mu = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__nu = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__sigma_star = 0;
  std::unique_ptr<fst::ComposeOptions>  __pyx_v__opts;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__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 *);
  struct __pyx_opt_args_7_pynini__compile_or_copy_Fst __pyx_t_6;
  std::string __pyx_t_7;
  enum fst::ComposeFilter __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("leniently_compose", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_compose_filter = __pyx_optional_args->compose_filter;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_connect = __pyx_optional_args->connect;
      }
    }
  }

  /* "_pynini.pyx":1017
 *   cdef Fst _mu
 *   cdef Fst _nu
 *   (_mu, _nu) = _compile_or_copy_two_Fsts(mu, nu)             # <<<<<<<<<<<<<<
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star, _mu.arc_type())
 *   cdef unique_ptr[ComposeOptions] _opts
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_mu, __pyx_v_nu); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1017, __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, 1017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __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, 1017, __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, 1017, __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, 1017, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1017, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1017, __pyx_L1_error)
  __pyx_v__mu = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__nu = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1018
 *   cdef Fst _nu
 *   (_mu, _nu) = _compile_or_copy_two_Fsts(mu, nu)
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star, _mu.arc_type())             # <<<<<<<<<<<<<<
 *   cdef unique_ptr[ComposeOptions] _opts
 *   _opts.reset(
 */
  if (unlikely(((PyObject *)__pyx_v__mu) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1018, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__mu->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__mu), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.arc_type = __pyx_t_1;
  __pyx_t_3 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_sigma_star, &__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__sigma_star = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1022
 *   _opts.reset(
 *       new ComposeOptions(connect,
 *                          _get_compose_filter(tostring(compose_filter))))             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_mu.arc_type())
 *   LenientlyCompose(deref(_mu._fst),
 */
  __pyx_t_7 = __pyx_f_10_pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_10_pywrapfst__get_compose_filter(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L1_error)

  /* "_pynini.pyx":1020
 *   cdef Fst _sigma_star = _compile_or_copy_Fst(sigma_star, _mu.arc_type())
 *   cdef unique_ptr[ComposeOptions] _opts
 *   _opts.reset(             # <<<<<<<<<<<<<<
 *       new ComposeOptions(connect,
 *                          _get_compose_filter(tostring(compose_filter))))
 */
  __pyx_v__opts.reset(new fst::ComposeOptions(__pyx_v_connect, __pyx_t_8));

  /* "_pynini.pyx":1023
 *       new ComposeOptions(connect,
 *                          _get_compose_filter(tostring(compose_filter))))
 *   cdef Fst result = Fst(_mu.arc_type())             # <<<<<<<<<<<<<<
 *   LenientlyCompose(deref(_mu._fst),
 *                    deref(_nu._fst),
 */
  if (unlikely(((PyObject *)__pyx_v__mu) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1023, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__mu->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__mu), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1024
 *                          _get_compose_filter(tostring(compose_filter))))
 *   cdef Fst result = Fst(_mu.arc_type())
 *   LenientlyCompose(deref(_mu._fst),             # <<<<<<<<<<<<<<
 *                    deref(_nu._fst),
 *                    deref(_sigma_star._fst),
 */
  if (unlikely(((PyObject *)__pyx_v__mu) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1024, __pyx_L1_error)
  }

  /* "_pynini.pyx":1025
 *   cdef Fst result = Fst(_mu.arc_type())
 *   LenientlyCompose(deref(_mu._fst),
 *                    deref(_nu._fst),             # <<<<<<<<<<<<<<
 *                    deref(_sigma_star._fst),
 *                    result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v__nu) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1025, __pyx_L1_error)
  }

  /* "_pynini.pyx":1026
 *   LenientlyCompose(deref(_mu._fst),
 *                    deref(_nu._fst),
 *                    deref(_sigma_star._fst),             # <<<<<<<<<<<<<<
 *                    result._mfst.get(),
 *                    deref(_opts))
 */
  if (unlikely(((PyObject *)__pyx_v__sigma_star) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1026, __pyx_L1_error)
  }

  /* "_pynini.pyx":1024
 *                          _get_compose_filter(tostring(compose_filter))))
 *   cdef Fst result = Fst(_mu.arc_type())
 *   LenientlyCompose(deref(_mu._fst),             # <<<<<<<<<<<<<<
 *                    deref(_nu._fst),
 *                    deref(_sigma_star._fst),
 */
  fst::script::LenientlyCompose((*__pyx_v__mu->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__nu->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__sigma_star->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts));

  /* "_pynini.pyx":1029
 *                    result._mfst.get(),
 *                    deref(_opts))
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error)

  /* "_pynini.pyx":1030
 *                    deref(_opts))
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":986
 * 
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",             # <<<<<<<<<<<<<<
 *                             bool connect=True):
 *   """
 */

  /* 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("_pynini.leniently_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__mu);
  __Pyx_XDECREF((PyObject *)__pyx_v__nu);
  __Pyx_XDECREF((PyObject *)__pyx_v__sigma_star);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15leniently_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_14leniently_compose[] = "\n  leniently_compose(mu, nu, sigma_star, compose_filter=\"auto\", connect=True)\n\n  Constructively leniently-composes two FSTs.\n\n  This operation computes the lenient composition of two FSTs. The lenient\n  composition of two FSTs is the priority union of their composition and the\n  left-hand side argument, where priority union is simply union in which the\n  left-hand side argument's relations have \"priority\" over the right-hand side\n  argument's relations.\n\n  Args:\n    mu: The first input FST, taking higher priority.\n    nu: The second input FST, taking lower priority.\n    sigma_star: A cyclic, unweighted acceptor representing the closure over the\n        alphabet.\n    compose_filter: A string matching a known composition filter; one of:\n        \"alt_sequence\", \"auto\", \"match\", \"no_match\", \"null\", \"sequence\",\n        \"trivial\".\n    connect: Should output be trimmed?\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_15leniently_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mu = 0;
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_sigma_star = 0;
  PyObject *__pyx_v_compose_filter = 0;
  bool __pyx_v_connect;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leniently_compose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mu,&__pyx_n_s_nu,&__pyx_n_s_sigma_star,&__pyx_n_s_compose_filter,&__pyx_n_s_connect,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_u_auto);
    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_mu)) != 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_nu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("leniently_compose", 0, 3, 5, 1); __PYX_ERR(0, 986, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_star)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("leniently_compose", 0, 3, 5, 2); __PYX_ERR(0, 986, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter);
          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_connect);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "leniently_compose") < 0)) __PYX_ERR(0, 986, __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);
        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_mu = values[0];
    __pyx_v_nu = values[1];
    __pyx_v_sigma_star = values[2];
    __pyx_v_compose_filter = values[3];
    if (values[4]) {
      __pyx_v_connect = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 987, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":987
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",
 *                             bool connect=True):             # <<<<<<<<<<<<<<
 *   """
 *   leniently_compose(mu, nu, sigma_star, compose_filter="auto", connect=True)
 */
      __pyx_v_connect = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("leniently_compose", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 986, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.leniently_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_14leniently_compose(__pyx_self, __pyx_v_mu, __pyx_v_nu, __pyx_v_sigma_star, __pyx_v_compose_filter, __pyx_v_connect);

  /* "_pynini.pyx":986
 * 
 * 
 * cpdef Fst leniently_compose(mu, nu, sigma_star, compose_filter="auto",             # <<<<<<<<<<<<<<
 *                             bool connect=True):
 *   """
 */

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

static PyObject *__pyx_pf_7_pynini_14leniently_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_nu, PyObject *__pyx_v_sigma_star, PyObject *__pyx_v_compose_filter, bool __pyx_v_connect) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_leniently_compose __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("leniently_compose", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.compose_filter = __pyx_v_compose_filter;
  __pyx_t_2.connect = __pyx_v_connect;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_leniently_compose(__pyx_v_mu, __pyx_v_nu, __pyx_v_sigma_star, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1033
 * 
 * 
 * cpdef Fst string_file(filename,             # <<<<<<<<<<<<<<
 *                       arc_type="standard",
 *                       input_token_type=None,
 */

static PyObject *__pyx_pw_7_pynini_17string_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_string_file(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_string_file *__pyx_optional_args) {
  PyObject *__pyx_v_arc_type = ((PyObject *)__pyx_n_u_standard);

  /* "_pynini.pyx":1035
 * cpdef Fst string_file(filename,
 *                       arc_type="standard",
 *                       input_token_type=None,             # <<<<<<<<<<<<<<
 *                       output_token_type=None):
 *   """
 */
  PyObject *__pyx_v_input_token_type = ((PyObject *)Py_None);

  /* "_pynini.pyx":1036
 *                       arc_type="standard",
 *                       input_token_type=None,
 *                       output_token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   string_file(filename, arc_type="standard",
 */
  PyObject *__pyx_v_output_token_type = ((PyObject *)Py_None);
  fst::TokenType __pyx_v__input_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__isymbols;
  fst::TokenType __pyx_v__output_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__osymbols;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  fst::SymbolTable const *__pyx_t_5;
  std::string __pyx_t_6;
  fst::TokenType __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string_file", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_arc_type = __pyx_optional_args->arc_type;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_input_token_type = __pyx_optional_args->input_token_type;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_output_token_type = __pyx_optional_args->output_token_type;
        }
      }
    }
  }

  /* "_pynini.pyx":1083
 *   """
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL             # <<<<<<<<<<<<<<
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()
 */
  __pyx_v__isymbols = NULL;

  /* "_pynini.pyx":1084
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:             # <<<<<<<<<<<<<<
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_input_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":1085
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__input_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":1086
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL
 */
    __pyx_v__isymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":1084
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:             # <<<<<<<<<<<<<<
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":1087
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_input_token_type, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":1088
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *   else:
 */
    __pyx_v__input_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":1089
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *   else:
 *     _input_token_type = _get_token_type(tostring(input_token_type))
 */
    if (unlikely(__pyx_v_input_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 1089, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1089, __pyx_L1_error)
    __pyx_v__isymbols = __pyx_t_5;

    /* "_pynini.pyx":1087
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":1091
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *   else:
 *     _input_token_type = _get_token_type(tostring(input_token_type))             # <<<<<<<<<<<<<<
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_input_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1091, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1091, __pyx_L1_error)
    __pyx_v__input_token_type = __pyx_t_7;
  }
  __pyx_L3:;

  /* "_pynini.pyx":1093
 *     _input_token_type = _get_token_type(tostring(input_token_type))
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL             # <<<<<<<<<<<<<<
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()
 */
  __pyx_v__osymbols = NULL;

  /* "_pynini.pyx":1094
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:             # <<<<<<<<<<<<<<
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_output_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":1095
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__output_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":1096
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL
 */
    __pyx_v__osymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":1094
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:             # <<<<<<<<<<<<<<
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":1097
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_output_token_type, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":1098
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *   else:
 */
    __pyx_v__output_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":1099
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *   else:
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 */
    if (unlikely(__pyx_v_output_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 1099, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1099, __pyx_L1_error)
    __pyx_v__osymbols = __pyx_t_5;

    /* "_pynini.pyx":1097
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":1101
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *   else:
 *     _output_token_type = _get_token_type(tostring(output_token_type))             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(arc_type=arc_type)
 *   if not StringFileCompile(path_tostring(filename),
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_output_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L1_error)
    __pyx_v__output_token_type = __pyx_t_7;
  }
  __pyx_L4:;

  /* "_pynini.pyx":1102
 *   else:
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef Fst result = Fst(arc_type=arc_type)             # <<<<<<<<<<<<<<
 *   if not StringFileCompile(path_tostring(filename),
 *                            result._mfst.get(),
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_arc_type, __pyx_v_arc_type) < 0) __PYX_ERR(0, 1102, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "_pynini.pyx":1103
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef Fst result = Fst(arc_type=arc_type)
 *   if not StringFileCompile(path_tostring(filename),             # <<<<<<<<<<<<<<
 *                            result._mfst.get(),
 *                            _input_token_type,
 */
  __pyx_t_6 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L1_error)

  /* "_pynini.pyx":1108
 *                            _output_token_type,
 *                            _isymbols,
 *                            _osymbols):             # <<<<<<<<<<<<<<
 *     raise FstIOError("Read failed")
 *   return result
 */
  __pyx_t_1 = ((!(fst::script::StringFileCompile(__pyx_t_6, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), __pyx_v__input_token_type, __pyx_v__output_token_type, __pyx_v__isymbols, __pyx_v__osymbols) != 0)) != 0);

  /* "_pynini.pyx":1103
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef Fst result = Fst(arc_type=arc_type)
 *   if not StringFileCompile(path_tostring(filename),             # <<<<<<<<<<<<<<
 *                            result._mfst.get(),
 *                            _input_token_type,
 */
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":1109
 *                            _isymbols,
 *                            _osymbols):
 *     raise FstIOError("Read failed")             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_kp_u_Read_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Read_failed);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1109, __pyx_L1_error)

    /* "_pynini.pyx":1103
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef Fst result = Fst(arc_type=arc_type)
 *   if not StringFileCompile(path_tostring(filename),             # <<<<<<<<<<<<<<
 *                            result._mfst.get(),
 *                            _input_token_type,
 */
  }

  /* "_pynini.pyx":1110
 *                            _osymbols):
 *     raise FstIOError("Read failed")
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1033
 * 
 * 
 * cpdef Fst string_file(filename,             # <<<<<<<<<<<<<<
 *                       arc_type="standard",
 *                       input_token_type=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_pynini.string_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_17string_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_16string_file[] = "\n  string_file(filename, arc_type=\"standard\",\n              input_token_type=None, output_token_type=None)\n\n  Creates a transducer that maps between elements of mappings read from\n  a tab-delimited file.\n\n  The first column is interpreted as the input string to a transduction.\n\n  The second column, separated from the first by a single tab character, is\n  interpreted as the output string for the transduction; an acceptor can be\n  modeled by using identical first and second columns.\n\n  An optional third column, separated from the second by a single tab character,\n  is interpreted as a weight for the transduction; if not specified the weight\n  defaults to semiring One. Note that weights are never permitted in the second\n  column.\n\n  The comment character is #, and has scope until the end of the line. Any\n  preceding whitespace before a comment is ignored. To use the '#' literal\n  (i.e., to ensure it is not interpreted as the start of a comment) escape it\n  with \\; the escaping \\ in the string \"\\#\" also ignored.\n\n  Args:\n    filename: The path to a TSV file formatted as described above.\n    arc_type: A string indicating the arc type.\n    input_token_type: An optional string indicating how the input strings are\n        to be encoded as arc labels---one of: \"utf8\" (encodes strings as a UTF-8\n        encoded Unicode strings), \"byte\" (encodes strings as raw bytes)---or a\n        SymbolTable. If not set, or set to None, the value is set to the\n        default token_type, which begins as \"byte\", but can be overridden for\n        regions of code using the default_token_type context manager.\n    output_token_type: An optional string indicating how the output strings are\n        to be encoded as arc labels---one of: \"utf8\" (encodes strings as a UTF-8\n        encoded Unicode strings), \"byte\" (encodes strings as raw bytes)---or a\n        SymbolTable. If not set, or set to None, the value is set to the\n        default token_type,"" which begins as \"byte\", but can be overridden for\n        regions of code using the default_token_type context manager.\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstIOError: Read failed.\n  ";
static PyObject *__pyx_pw_7_pynini_17string_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_arc_type = 0;
  PyObject *__pyx_v_input_token_type = 0;
  PyObject *__pyx_v_output_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_file (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_arc_type,&__pyx_n_s_input_token_type,&__pyx_n_s_output_token_type,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_standard);

    /* "_pynini.pyx":1035
 * cpdef Fst string_file(filename,
 *                       arc_type="standard",
 *                       input_token_type=None,             # <<<<<<<<<<<<<<
 *                       output_token_type=None):
 *   """
 */
    values[2] = ((PyObject *)Py_None);

    /* "_pynini.pyx":1036
 *                       arc_type="standard",
 *                       input_token_type=None,
 *                       output_token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   string_file(filename, arc_type="standard",
 */
    values[3] = ((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  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_filename)) != 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_arc_type);
          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_input_token_type);
          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_output_token_type);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string_file") < 0)) __PYX_ERR(0, 1033, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_filename = values[0];
    __pyx_v_arc_type = values[1];
    __pyx_v_input_token_type = values[2];
    __pyx_v_output_token_type = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string_file", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1033, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.string_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_16string_file(__pyx_self, __pyx_v_filename, __pyx_v_arc_type, __pyx_v_input_token_type, __pyx_v_output_token_type);

  /* "_pynini.pyx":1033
 * 
 * 
 * cpdef Fst string_file(filename,             # <<<<<<<<<<<<<<
 *                       arc_type="standard",
 *                       input_token_type=None,
 */

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

static PyObject *__pyx_pf_7_pynini_16string_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_string_file __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string_file", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.arc_type = __pyx_v_arc_type;
  __pyx_t_2.input_token_type = __pyx_v_input_token_type;
  __pyx_t_2.output_token_type = __pyx_v_output_token_type;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_string_file(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1113
 * 
 * 
 * cpdef Fst string_map(lines,             # <<<<<<<<<<<<<<
 *                      arc_type="standard",
 *                      input_token_type=None,
 */

static PyObject *__pyx_pw_7_pynini_19string_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_string_map(PyObject *__pyx_v_lines, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_string_map *__pyx_optional_args) {
  PyObject *__pyx_v_arc_type = ((PyObject *)__pyx_n_u_standard);

  /* "_pynini.pyx":1115
 * cpdef Fst string_map(lines,
 *                      arc_type="standard",
 *                      input_token_type=None,             # <<<<<<<<<<<<<<
 *                      output_token_type=None):
 *   """
 */
  PyObject *__pyx_v_input_token_type = ((PyObject *)Py_None);

  /* "_pynini.pyx":1116
 *                      arc_type="standard",
 *                      input_token_type=None,
 *                      output_token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   string_map(lines, arc_type="standard",
 */
  PyObject *__pyx_v_output_token_type = ((PyObject *)Py_None);
  fst::TokenType __pyx_v__input_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__isymbols;
  fst::TokenType __pyx_v__output_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__osymbols;
  std::vector<std::vector<std::string> >  __pyx_v__lines;
  PyObject *__pyx_v_line = NULL;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  PyObject *__pyx_8genexpr1__pyx_v_elem = NULL;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  fst::SymbolTable const *__pyx_t_5;
  std::string __pyx_t_6;
  fst::TokenType __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  std::vector<std::string>  __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string_map", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_arc_type = __pyx_optional_args->arc_type;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_input_token_type = __pyx_optional_args->input_token_type;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_output_token_type = __pyx_optional_args->output_token_type;
        }
      }
    }
  }

  /* "_pynini.pyx":1152
 *   """
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL             # <<<<<<<<<<<<<<
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()
 */
  __pyx_v__isymbols = NULL;

  /* "_pynini.pyx":1153
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:             # <<<<<<<<<<<<<<
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_input_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":1154
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__input_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":1155
 *   if input_token_type is None:
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL
 */
    __pyx_v__isymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":1153
 *   cdef _TokenType _input_token_type
 *   cdef const_SymbolTable_ptr _isymbols = NULL
 *   if input_token_type is None:             # <<<<<<<<<<<<<<
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":1156
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_input_token_type, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":1157
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *   else:
 */
    __pyx_v__input_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":1158
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *   else:
 *     _input_token_type = _get_token_type(tostring(input_token_type))
 */
    if (unlikely(__pyx_v_input_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 1158, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1158, __pyx_L1_error)
    __pyx_v__isymbols = __pyx_t_5;

    /* "_pynini.pyx":1156
 *     _input_token_type = GetDefaultTokenType()
 *     _isymbols = GetDefaultSymbols()
 *   elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _input_token_type = _TokenType.SYMBOL
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":1160
 *     _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *   else:
 *     _input_token_type = _get_token_type(tostring(input_token_type))             # <<<<<<<<<<<<<<
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_input_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1160, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1160, __pyx_L1_error)
    __pyx_v__input_token_type = __pyx_t_7;
  }
  __pyx_L3:;

  /* "_pynini.pyx":1162
 *     _input_token_type = _get_token_type(tostring(input_token_type))
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL             # <<<<<<<<<<<<<<
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()
 */
  __pyx_v__osymbols = NULL;

  /* "_pynini.pyx":1163
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:             # <<<<<<<<<<<<<<
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_output_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":1164
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__output_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":1165
 *   if output_token_type is None:
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL
 */
    __pyx_v__osymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":1163
 *   cdef _TokenType _output_token_type
 *   cdef const_SymbolTable_ptr _osymbols = NULL
 *   if output_token_type is None:             # <<<<<<<<<<<<<<
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":1166
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_output_token_type, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":1167
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *   else:
 */
    __pyx_v__output_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":1168
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *   else:
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 */
    if (unlikely(__pyx_v_output_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 1168, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1168, __pyx_L1_error)
    __pyx_v__osymbols = __pyx_t_5;

    /* "_pynini.pyx":1166
 *     _output_token_type = GetDefaultTokenType()
 *     _osymbols = GetDefaultSymbols()
 *   elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *     _output_token_type = _TokenType.SYMBOL
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":1170
 *     _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *   else:
 *     _output_token_type = _get_token_type(tostring(output_token_type))             # <<<<<<<<<<<<<<
 *   cdef vector[vector[string]] _lines
 *   for line in lines:
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_output_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1170, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1170, __pyx_L1_error)
    __pyx_v__output_token_type = __pyx_t_7;
  }
  __pyx_L4:;

  /* "_pynini.pyx":1172
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef vector[vector[string]] _lines
 *   for line in lines:             # <<<<<<<<<<<<<<
 *     if isinstance(line, str):
 *       _lines.push_back([tostring(line)])
 */
  if (likely(PyList_CheckExact(__pyx_v_lines)) || PyTuple_CheckExact(__pyx_v_lines)) {
    __pyx_t_3 = __pyx_v_lines; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lines); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1172, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1172, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1172, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1172, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1172, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_3);
      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, 1172, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "_pynini.pyx":1173
 *   cdef vector[vector[string]] _lines
 *   for line in lines:
 *     if isinstance(line, str):             # <<<<<<<<<<<<<<
 *       _lines.push_back([tostring(line)])
 *     else:
 */
    __pyx_t_1 = PyUnicode_Check(__pyx_v_line); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "_pynini.pyx":1174
 *   for line in lines:
 *     if isinstance(line, str):
 *       _lines.push_back([tostring(line)])             # <<<<<<<<<<<<<<
 *     else:
 *       _lines.push_back([tostring(elem) for elem in line])
 */
      __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_line); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1174, __pyx_L1_error)
      __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_11 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1174, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      try {
        __pyx_v__lines.push_back(__pyx_t_11);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 1174, __pyx_L1_error)
      }

      /* "_pynini.pyx":1173
 *   cdef vector[vector[string]] _lines
 *   for line in lines:
 *     if isinstance(line, str):             # <<<<<<<<<<<<<<
 *       _lines.push_back([tostring(line)])
 *     else:
 */
      goto __pyx_L7;
    }

    /* "_pynini.pyx":1176
 *       _lines.push_back([tostring(line)])
 *     else:
 *       _lines.push_back([tostring(elem) for elem in line])             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(arc_type)
 *   if not StringMapCompile(_lines,
 */
    /*else*/ {
      { /* enter inner scope */
        __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1176, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (likely(PyList_CheckExact(__pyx_v_line)) || PyTuple_CheckExact(__pyx_v_line)) {
          __pyx_t_4 = __pyx_v_line; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
          __pyx_t_13 = NULL;
        } else {
          __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_line); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1176, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1176, __pyx_L10_error)
        }
        for (;;) {
          if (likely(!__pyx_t_13)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_14); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1176, __pyx_L10_error)
              #else
              __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1176, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_14);
              #endif
            } else {
              if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_14); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1176, __pyx_L10_error)
              #else
              __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1176, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_14);
              #endif
            }
          } else {
            __pyx_t_14 = __pyx_t_13(__pyx_t_4);
            if (unlikely(!__pyx_t_14)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1176, __pyx_L10_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_14);
          }
          __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_elem, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_8genexpr1__pyx_v_elem); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1176, __pyx_L10_error)
          __pyx_t_14 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1176, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 1176, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_elem); __pyx_8genexpr1__pyx_v_elem = 0;
        goto __pyx_L13_exit_scope;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_elem); __pyx_8genexpr1__pyx_v_elem = 0;
        goto __pyx_L1_error;
        __pyx_L13_exit_scope:;
      } /* exit inner scope */
      __pyx_t_11 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1176, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      try {
        __pyx_v__lines.push_back(__pyx_t_11);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 1176, __pyx_L1_error)
      }
    }
    __pyx_L7:;

    /* "_pynini.pyx":1172
 *     _output_token_type = _get_token_type(tostring(output_token_type))
 *   cdef vector[vector[string]] _lines
 *   for line in lines:             # <<<<<<<<<<<<<<
 *     if isinstance(line, str):
 *       _lines.push_back([tostring(line)])
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1177
 *     else:
 *       _lines.push_back([tostring(elem) for elem in line])
 *   cdef Fst result = Fst(arc_type)             # <<<<<<<<<<<<<<
 *   if not StringMapCompile(_lines,
 *                           result._mfst.get(),
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_v_arc_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1178
 *       _lines.push_back([tostring(elem) for elem in line])
 *   cdef Fst result = Fst(arc_type)
 *   if not StringMapCompile(_lines,             # <<<<<<<<<<<<<<
 *                           result._mfst.get(),
 *                           _input_token_type,
 */
  __pyx_t_2 = ((!(fst::script::StringMapCompile(__pyx_v__lines, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), __pyx_v__input_token_type, __pyx_v__output_token_type, __pyx_v__isymbols, __pyx_v__osymbols) != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "_pynini.pyx":1184
 *                           _isymbols,
 *                           _osymbols):
 *     raise FstArgError("String map compilation failed")             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1184, __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_4, __pyx_kp_u_String_map_compilation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_u_String_map_compilation_failed);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1184, __pyx_L1_error)

    /* "_pynini.pyx":1178
 *       _lines.push_back([tostring(elem) for elem in line])
 *   cdef Fst result = Fst(arc_type)
 *   if not StringMapCompile(_lines,             # <<<<<<<<<<<<<<
 *                           result._mfst.get(),
 *                           _input_token_type,
 */
  }

  /* "_pynini.pyx":1185
 *                           _osymbols):
 *     raise FstArgError("String map compilation failed")
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1113
 * 
 * 
 * cpdef Fst string_map(lines,             # <<<<<<<<<<<<<<
 *                      arc_type="standard",
 *                      input_token_type=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("_pynini.string_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_elem);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19string_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_18string_map[] = "\n  string_map(lines, arc_type=\"standard\",\n             input_token_type=None, output_token_type=None)\n\n  Creates an acceptor or cross-product transducer that maps between\n  elements of mappings read from an iterable.\n\n  Args:\n    lines: An iterable of iterables of size one, two, or three, or an iterable\n        of strings. The first element in each indexable (or each string, if the\n        input is an iterable of strings) is interpreted as the input string,\n        the second (optional) as the output string, defaulting to the input\n        string, and the third (optional) as a string to be parsed as a weight,\n        defaulting to semiring One.\n    arc_type: A string indicating the arc type.\n    input_token_type: An optional string indicating how the input strings are to\n        be encoded as arc labels---one of: \"utf8\" (encodes strings as a UTF-8\n        encoded Unicode strings), \"byte\" (encodes strings as raw bytes)---or a\n        SymbolTable. If not set, or set to None, the value is set to the\n        default token_type, which begins as \"byte\", but can be overridden for\n        regions of code using the default_token_type context manager.\n    output_token_type: An optional string indicating how the output strings are\n        to be encoded as arc labels---one of: \"utf8\" (encodes strings as a UTF-8\n        encoded Unicode strings), \"byte\" (encodes strings as raw bytes)---or a\n        SymbolTable. If not set, or set to None, the value is set to the\n        default token_type, which begins as \"byte\", but can be overridden for\n        regions of code using the default_token_type context manager.\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstArgError: String map compilation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_19string_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lines = 0;
  PyObject *__pyx_v_arc_type = 0;
  PyObject *__pyx_v_input_token_type = 0;
  PyObject *__pyx_v_output_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lines,&__pyx_n_s_arc_type,&__pyx_n_s_input_token_type,&__pyx_n_s_output_token_type,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_standard);

    /* "_pynini.pyx":1115
 * cpdef Fst string_map(lines,
 *                      arc_type="standard",
 *                      input_token_type=None,             # <<<<<<<<<<<<<<
 *                      output_token_type=None):
 *   """
 */
    values[2] = ((PyObject *)Py_None);

    /* "_pynini.pyx":1116
 *                      arc_type="standard",
 *                      input_token_type=None,
 *                      output_token_type=None):             # <<<<<<<<<<<<<<
 *   """
 *   string_map(lines, arc_type="standard",
 */
    values[3] = ((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  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_lines)) != 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_arc_type);
          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_input_token_type);
          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_output_token_type);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string_map") < 0)) __PYX_ERR(0, 1113, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_lines = values[0];
    __pyx_v_arc_type = values[1];
    __pyx_v_input_token_type = values[2];
    __pyx_v_output_token_type = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string_map", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.string_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_18string_map(__pyx_self, __pyx_v_lines, __pyx_v_arc_type, __pyx_v_input_token_type, __pyx_v_output_token_type);

  /* "_pynini.pyx":1113
 * 
 * 
 * cpdef Fst string_map(lines,             # <<<<<<<<<<<<<<
 *                      arc_type="standard",
 *                      input_token_type=None,
 */

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

static PyObject *__pyx_pf_7_pynini_18string_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lines, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_string_map __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string_map", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.arc_type = __pyx_v_arc_type;
  __pyx_t_2.input_token_type = __pyx_v_input_token_type;
  __pyx_t_2.output_token_type = __pyx_v_output_token_type;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_string_map(__pyx_v_lines, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1205
 *   # Doing so will allow undefined behavior.
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<const pointer SymbolTableView {self.name()!r} at 0x{id(self):x}>"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_23_PointerSymbolTableView___repr__(((struct __pyx_obj_7_pynini__PointerSymbolTableView *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView___repr__(struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __pyx_t_3;
  std::string __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "_pynini.pyx":1206
 * 
 *   def __repr__(self):
 *     return f"<const pointer SymbolTableView {self.name()!r} at 0x{id(self):x}>"             # <<<<<<<<<<<<<<
 * 
 *   cdef const_SymbolTable_ptr _raw(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u_const_pointer_SymbolTableView);
  __pyx_t_2 += 31;
  __Pyx_GIVEREF(__pyx_kp_u_const_pointer_SymbolTableView);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_const_pointer_SymbolTableView);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "name");
    __PYX_ERR(0, 1206, __pyx_L1_error)
  }
  __pyx_t_4 = ((struct __pyx_vtabstruct_7_pynini__PointerSymbolTableView *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.name(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_self), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L1_error)
  __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_at_0x);
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_6, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__3);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1205
 *   # Doing so will allow undefined behavior.
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<const pointer SymbolTableView {self.name()!r} at 0x{id(self):x}>"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("_pynini._PointerSymbolTableView.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1208
 *     return f"<const pointer SymbolTableView {self.name()!r} at 0x{id(self):x}>"
 * 
 *   cdef const_SymbolTable_ptr _raw(self):             # <<<<<<<<<<<<<<
 *     return self._symbols
 * 
 */

static __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_f_7_pynini_23_PointerSymbolTableView__raw(struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self) {
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raw", 0);

  /* "_pynini.pyx":1209
 * 
 *   cdef const_SymbolTable_ptr _raw(self):
 *     return self._symbols             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_symbols");
    __PYX_ERR(0, 1209, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_symbols;
  goto __pyx_L0;

  /* "_pynini.pyx":1208
 *     return f"<const pointer SymbolTableView {self.name()!r} at 0x{id(self):x}>"
 * 
 *   cdef const_SymbolTable_ptr _raw(self):             # <<<<<<<<<<<<<<
 *     return self._symbols
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_pynini._PointerSymbolTableView._raw", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_23_PointerSymbolTableView_2__reduce_cython__(((struct __pyx_obj_7_pynini__PointerSymbolTableView *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__PointerSymbolTableView *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._PointerSymbolTableView.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_23_PointerSymbolTableView_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_23_PointerSymbolTableView_4__setstate_cython__(((struct __pyx_obj_7_pynini__PointerSymbolTableView *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7_pynini_23_PointerSymbolTableView_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._PointerSymbolTableView.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1212
 * 
 * 
 * cpdef _PointerSymbolTableView generated_symbols():             # <<<<<<<<<<<<<<
 *   """Returns a view of a symbol table containing generated symbols."""
 *   cdef _PointerSymbolTableView _symbols = (
 */

static PyObject *__pyx_pw_7_pynini_21generated_symbols(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_f_7_pynini_generated_symbols(CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini__PointerSymbolTableView *__pyx_v__symbols = 0;
  struct __pyx_obj_7_pynini__PointerSymbolTableView *__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("generated_symbols", 0);

  /* "_pynini.pyx":1215
 *   """Returns a view of a symbol table containing generated symbols."""
 *   cdef _PointerSymbolTableView _symbols = (
 *       _PointerSymbolTableView.__new__(_PointerSymbolTableView))             # <<<<<<<<<<<<<<
 *   _symbols._symbols = addr(GeneratedSymbols())
 *   return _symbols
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini__PointerSymbolTableView(((PyTypeObject *)__pyx_ptype_7_pynini__PointerSymbolTableView), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v__symbols = ((struct __pyx_obj_7_pynini__PointerSymbolTableView *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1216
 *   cdef _PointerSymbolTableView _symbols = (
 *       _PointerSymbolTableView.__new__(_PointerSymbolTableView))
 *   _symbols._symbols = addr(GeneratedSymbols())             # <<<<<<<<<<<<<<
 *   return _symbols
 * 
 */
  if (unlikely(((PyObject *)__pyx_v__symbols) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_symbols");
    __PYX_ERR(0, 1216, __pyx_L1_error)
  }
  __pyx_v__symbols->_symbols = (&fst::GeneratedSymbols());

  /* "_pynini.pyx":1217
 *       _PointerSymbolTableView.__new__(_PointerSymbolTableView))
 *   _symbols._symbols = addr(GeneratedSymbols())
 *   return _symbols             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v__symbols));
  __pyx_r = __pyx_v__symbols;
  goto __pyx_L0;

  /* "_pynini.pyx":1212
 * 
 * 
 * cpdef _PointerSymbolTableView generated_symbols():             # <<<<<<<<<<<<<<
 *   """Returns a view of a symbol table containing generated symbols."""
 *   cdef _PointerSymbolTableView _symbols = (
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_21generated_symbols(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_20generated_symbols[] = "Returns a view of a symbol table containing generated symbols.";
static PyObject *__pyx_pw_7_pynini_21generated_symbols(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generated_symbols (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_20generated_symbols(__pyx_self);

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

static PyObject *__pyx_pf_7_pynini_20generated_symbols(CYTHON_UNUSED PyObject *__pyx_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("generated_symbols", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_generated_symbols(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_23_1arg_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_23_1arg_patch = {"_1arg_patch", (PyCFunction)__pyx_pw_7_pynini_23_1arg_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_23_1arg_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_1arg_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_22_1arg_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":1225
 * def _1arg_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_11_1arg_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_11_1arg_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_11_1arg_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_11_1arg_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 1225, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_fst = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._1arg_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_11_1arg_patch_patch(__pyx_self, __pyx_v_fst, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_11_1arg_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  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("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":1226
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 *   return patch
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1227
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 1227, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v__fst));
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_2, __pyx_t_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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10_pywrapfst_MutableFst))))) __PYX_ERR(0, 1227, __pyx_L1_error)
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__init_Fst_from_MutableFst(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_t_3))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __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;

  /* "_pynini.pyx":1225
 * def _1arg_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini._1arg_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_22_1arg_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_1arg_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_2__1arg_patch(__pyx_ptype_7_pynini___pyx_scope_struct_2__1arg_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1223, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":1224
 * 
 * def _1arg_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1224, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":1225
 * def _1arg_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_11_1arg_patch_1patch, 0, __pyx_n_s_1arg_patch_locals_patch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1228
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._1arg_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_25_shortestdistance_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_25_shortestdistance_patch = {"_shortestdistance_patch", (PyCFunction)__pyx_pw_7_pynini_25_shortestdistance_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_25_shortestdistance_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_shortestdistance_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_24_shortestdistance_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":1246
 * def _shortestdistance_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_23_shortestdistance_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_23_shortestdistance_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_23_shortestdistance_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_23_shortestdistance_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 1246, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_fst = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._shortestdistance_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_23_shortestdistance_patch_patch(__pyx_self, __pyx_v_fst, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_23_shortestdistance_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  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("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":1247
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *     return fnc(_fst, *args, **kwargs)
 *   return patch
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1248
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 1248, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v__fst));
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1246
 * def _shortestdistance_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini._shortestdistance_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_24_shortestdistance_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_shortestdistance_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_3__shortestdistance_patch(__pyx_ptype_7_pynini___pyx_scope_struct_3__shortestdistance_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1244, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":1245
 * 
 * def _shortestdistance_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(fst, *args, **kwargs):
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":1246
 * def _shortestdistance_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_23_shortestdistance_patch_1patch, 0, __pyx_n_s_shortestdistance_patch_locals_p, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1249
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._shortestdistance_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_27_compose_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_27_compose_patch = {"_compose_patch", (PyCFunction)__pyx_pw_7_pynini_27_compose_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_27_compose_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compose_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_26_compose_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":1262
 * def _compose_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14_compose_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_14_compose_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_14_compose_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_14_compose_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,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) {
        default:
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, 1); __PYX_ERR(0, 1262, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 1262, __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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._compose_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_14_compose_patch_patch(__pyx_self, __pyx_v_fst1, __pyx_v_fst2, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_14_compose_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":1265
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *     _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1265, __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, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1265, __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, 1265, __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, 1265, __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, 1265, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1265, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1265, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1266
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *     _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())             # <<<<<<<<<<<<<<
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))
 *   return patch
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1266, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1266, __pyx_L1_error)
  }
  __pyx_f_7_pynini__maybe_arcsort(__pyx_v__fst1->__pyx_base.__pyx_base._mfst.get(), __pyx_v__fst2->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":1267
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *     _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 1267, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v__fst1));
  __Pyx_INCREF(((PyObject *)__pyx_v__fst2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst2));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v__fst2));
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10_pywrapfst_MutableFst))))) __PYX_ERR(0, 1267, __pyx_L1_error)
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__init_Fst_from_MutableFst(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_t_2))); 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;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1262
 * def _compose_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

  /* 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("_pynini._compose_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_26_compose_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compose_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_4__compose_patch(__pyx_ptype_7_pynini___pyx_scope_struct_4__compose_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1260, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":1261
 * 
 * def _compose_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(fst1, fst2, *args, **kwargs):
 *     cdef Fst _fst1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1261, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":1262
 * def _compose_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_14_compose_patch_1patch, 0, __pyx_n_s_compose_patch_locals_patch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1268
 *     _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._compose_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_29_difference_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_29_difference_patch = {"_difference_patch", (PyCFunction)__pyx_pw_7_pynini_29_difference_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_29_difference_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_difference_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_28_difference_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":1277
 * def _difference_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_17_difference_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_17_difference_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_17_difference_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_17_difference_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,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) {
        default:
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, 1); __PYX_ERR(0, 1277, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 1277, __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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._difference_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_17_difference_patch_patch(__pyx_self, __pyx_v_fst1, __pyx_v_fst2, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_17_difference_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":1280
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *     # Makes RHS epsilon-free and deterministic.
 *     OptimizeDifferenceRhs(_fst2._mfst.get(), True)
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1280, __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, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __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, 1280, __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, 1280, __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, 1280, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1280, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1280, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1282
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *     # Makes RHS epsilon-free and deterministic.
 *     OptimizeDifferenceRhs(_fst2._mfst.get(), True)             # <<<<<<<<<<<<<<
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))
 *   return patch
 */
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  fst::script::OptimizeDifferenceRhs(__pyx_v__fst2->__pyx_base.__pyx_base._mfst.get(), 1);

  /* "_pynini.pyx":1283
 *     # Makes RHS epsilon-free and deterministic.
 *     OptimizeDifferenceRhs(_fst2._mfst.get(), True)
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 1283, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v__fst1));
  __Pyx_INCREF(((PyObject *)__pyx_v__fst2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst2));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v__fst2));
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10_pywrapfst_MutableFst))))) __PYX_ERR(0, 1283, __pyx_L1_error)
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__init_Fst_from_MutableFst(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __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;

  /* "_pynini.pyx":1277
 * def _difference_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

  /* 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("_pynini._difference_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_28_difference_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_difference_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_5__difference_patch(__pyx_ptype_7_pynini___pyx_scope_struct_5__difference_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1275, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":1276
 * 
 * def _difference_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(fst1, fst2, *args, **kwargs):
 *     cdef Fst _fst1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":1277
 * def _difference_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_17_difference_patch_1patch, 0, __pyx_n_s_difference_patch_locals_patch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1284
 *     OptimizeDifferenceRhs(_fst2._mfst.get(), True)
 *     return _init_Fst_from_MutableFst(fnc(_fst1, _fst2, *args, **kwargs))
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._difference_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_31_comp_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_31_comp_patch = {"_comp_patch", (PyCFunction)__pyx_pw_7_pynini_31_comp_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_31_comp_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_comp_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_30_comp_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":1295
 * def _comp_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_11_comp_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_11_comp_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_11_comp_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_11_comp_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,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) {
        default:
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, 1); __PYX_ERR(0, 1295, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 1295, __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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._comp_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_11_comp_patch_patch(__pyx_self, __pyx_v_fst1, __pyx_v_fst2, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_11_comp_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":1298
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *     return fnc(_fst1, _fst2, *args, **kwargs)
 *   return patch
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1298, __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, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __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, 1298, __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, 1298, __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, 1298, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1298, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1298, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1299
 *     cdef Fst _fst2
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *     return fnc(_fst1, _fst2, *args, **kwargs)             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 1299, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v__fst1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v__fst1));
  __Pyx_INCREF(((PyObject *)__pyx_v__fst2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v__fst2));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v__fst2));
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1295
 * def _comp_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */

  /* 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("_pynini._comp_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_30_comp_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_comp_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_6__comp_patch(__pyx_ptype_7_pynini___pyx_scope_struct_6__comp_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1293, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":1294
 * 
 * def _comp_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(fst1, fst2, *args, **kwargs):
 *     cdef Fst _fst1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1294, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":1295
 * def _comp_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_11_comp_patch_1patch, 0, __pyx_n_s_comp_patch_locals_patch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1300
 *     (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *     return fnc(_fst1, _fst2, *args, **kwargs)
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._comp_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1309
 * 
 * 
 * cpdef Fst concat(fst1, fst2):             # <<<<<<<<<<<<<<
 *   """
 *   concat(fst1, fst2)
 */

static PyObject *__pyx_pw_7_pynini_33concat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_concat(PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  struct __pyx_obj_7_pynini_Fst *__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("concat", 0);

  /* "_pynini.pyx":1329
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *   return _fst1.concat(_fst2)
 * 
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1329, __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, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __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, 1329, __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, 1329, __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, 1329, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1329, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1329, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1330
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   return _fst1.concat(_fst2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v__fst1), __pyx_n_s_concat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1330, __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_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v__fst2)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v__fst2));
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1330, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1309
 * 
 * 
 * cpdef Fst concat(fst1, fst2):             # <<<<<<<<<<<<<<
 *   """
 *   concat(fst1, fst2)
 */

  /* 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("_pynini.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_33concat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_32concat[] = "\n  concat(fst1, fst2)\n\n  Computes the concatenation (product) of two FSTs.\n\n  This operation destructively concatenates the FST with other FSTs. If A\n  transduces string x to y with weight a and B transduces string w to v with\n  weight b, then their concatenation transduces string xw to yv with weight\n  a \\otimes b.\n\n  Args:\n    fst1: The first FST.\n    fst2: The second FST.\n\n  Returns:\n    An FST.\n  ";
static PyObject *__pyx_pw_7_pynini_33concat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("concat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,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_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("concat", 1, 2, 2, 1); __PYX_ERR(0, 1309, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "concat") < 0)) __PYX_ERR(0, 1309, __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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("concat", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_32concat(__pyx_self, __pyx_v_fst1, __pyx_v_fst2);

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

static PyObject *__pyx_pf_7_pynini_32concat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2) {
  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("concat", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_concat(__pyx_v_fst1, __pyx_v_fst2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1333
 * 
 * 
 * cpdef Fst replace(pairs,             # <<<<<<<<<<<<<<
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 */

static PyObject *__pyx_pw_7_pynini_35replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_replace(PyObject *__pyx_v_pairs, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_replace *__pyx_optional_args) {
  PyObject *__pyx_v_call_arc_labeling = ((PyObject *)__pyx_n_u_input);
  PyObject *__pyx_v_return_arc_labeling = ((PyObject *)__pyx_n_u_neither);

  /* "_pynini.pyx":1336
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 *                   bool epsilon_on_replace=False,             # <<<<<<<<<<<<<<
 *                   int64_t return_label=0):
 *   """
 */
  bool __pyx_v_epsilon_on_replace = ((bool)0);
  int64_t __pyx_v_return_label = ((int64_t)0);
  PyObject *__pyx_8genexpr2__pyx_v_label = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_fst = NULL;
  struct __pyx_obj_7_pynini_Fst *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  struct __pyx_opt_args_10_pywrapfst_replace __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_call_arc_labeling = __pyx_optional_args->call_arc_labeling;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_return_arc_labeling = __pyx_optional_args->return_arc_labeling;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_epsilon_on_replace = __pyx_optional_args->epsilon_on_replace;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_return_label = __pyx_optional_args->return_label;
          }
        }
      }
    }
  }
  __Pyx_INCREF(__pyx_v_pairs);

  /* "_pynini.pyx":1374
 *   """
 *   # Keeps these in memory so they're not garbage-collected.
 *   pairs = [(label, _compile_or_copy_Fst(fst)) for (label, fst) in pairs]             # <<<<<<<<<<<<<<
 *   return Fst.from_pywrapfst(_replace(pairs,
 *                                      call_arc_labeling,
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
      __pyx_t_2 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1374, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1374, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1374, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1374, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1374, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1374, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      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, 1374, __pyx_L5_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_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1374, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1374, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        #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, 1374, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 1374, __pyx_L5_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1374, __pyx_L5_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_label, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_fst, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_5 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_8genexpr2__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1374, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1374, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_8genexpr2__pyx_v_label);
      __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_label);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_8genexpr2__pyx_v_label);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1374, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_fst); __pyx_8genexpr2__pyx_v_fst = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_label); __pyx_8genexpr2__pyx_v_label = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_fst); __pyx_8genexpr2__pyx_v_fst = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_label); __pyx_8genexpr2__pyx_v_label = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_pairs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1375
 *   # Keeps these in memory so they're not garbage-collected.
 *   pairs = [(label, _compile_or_copy_Fst(fst)) for (label, fst) in pairs]
 *   return Fst.from_pywrapfst(_replace(pairs,             # <<<<<<<<<<<<<<
 *                                      call_arc_labeling,
 *                                      return_arc_labeling,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_from_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "_pynini.pyx":1379
 *                                      return_arc_labeling,
 *                                      epsilon_on_replace,
 *                                      return_label))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_10.__pyx_n = 4;
  __pyx_t_10.call_arc_labeling = __pyx_v_call_arc_labeling;
  __pyx_t_10.return_arc_labeling = __pyx_v_return_arc_labeling;
  __pyx_t_10.epsilon_on_replace = __pyx_v_epsilon_on_replace;
  __pyx_t_10.return_label = __pyx_v_return_label;
  __pyx_t_7 = ((PyObject *)__pyx_f_10_pywrapfst_replace(__pyx_v_pairs, 0, &__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __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_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1375
 *   # Keeps these in memory so they're not garbage-collected.
 *   pairs = [(label, _compile_or_copy_Fst(fst)) for (label, fst) in pairs]
 *   return Fst.from_pywrapfst(_replace(pairs,             # <<<<<<<<<<<<<<
 *                                      call_arc_labeling,
 *                                      return_arc_labeling,
 */
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1375, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1333
 * 
 * 
 * cpdef Fst replace(pairs,             # <<<<<<<<<<<<<<
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_pynini.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_label);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_fst);
  __Pyx_XDECREF(__pyx_v_pairs);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_35replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_34replace[] = "\n  replace(pairs, call_arc_labeling=\"input\", return_arc_labeling=\"neither\",\n          epsilon_on_replace=False, return_label=0)\n\n  Recursively replaces arcs in the FST with other FST(s).\n\n  This operation performs the dynamic replacement of arcs in one FST with\n  another FST, allowing the definition of FSTs analogous to RTNs. It takes as\n  input a set of pairs of a set of pairs formed by a non-terminal label and\n  its corresponding FST, and a label identifying the root FST in that set.\n  The resulting FST is obtained by taking the root FST and recursively replacing\n  each arc having a nonterminal as output label by its corresponding FST. More\n  precisely, an arc from state s to state d with (nonterminal) output label n in\n  this FST is replaced by redirecting this \"call\" arc to the initial state of a\n  copy F of the FST for n, and adding \"return\" arcs from each final state of F\n  to d. Optional arguments control how the call and return arcs are labeled; by\n  default, the only non-epsilon label is placed on the call arc.\n\n  Args:\n    pairs: An iterable of (nonterminal label, FST) pairs, where the former is an\n        unsigned integer and the latter is an Fst instance.  \n    call_arc_labeling: A string indicating which call arc labels should be\n        non-epsilon. One of: \"input\" (default), \"output\", \"both\", \"neither\".\n        This value is set to \"neither\" if epsilon_on_replace is True.\n    return_arc_labeling: A string indicating which return arc labels should be\n        non-epsilon. One of: \"input\", \"output\", \"both\", \"neither\" (default).\n        This value is set to \"neither\" if epsilon_on_replace is True.\n    epsilon_on_replace: Should call and return arcs be epsilon arcs? If True,\n        this effectively overrides call_arc_labeling and return_arc_labeling,\n        setting both to \"neither\".\n    return_label: The integer label for return arcs.\n\n  Returns:\n    An FST.\n  ";
static PyObject *__pyx_pw_7_pynini_35replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pairs = 0;
  PyObject *__pyx_v_call_arc_labeling = 0;
  PyObject *__pyx_v_return_arc_labeling = 0;
  bool __pyx_v_epsilon_on_replace;
  int64_t __pyx_v_return_label;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pairs,&__pyx_n_s_call_arc_labeling,&__pyx_n_s_return_arc_labeling,&__pyx_n_s_epsilon_on_replace,&__pyx_n_s_return_label,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_input);
    values[2] = ((PyObject *)__pyx_n_u_neither);
    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_pairs)) != 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_call_arc_labeling);
          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_return_arc_labeling);
          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_epsilon_on_replace);
          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_return_label);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) __PYX_ERR(0, 1333, __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_pairs = values[0];
    __pyx_v_call_arc_labeling = values[1];
    __pyx_v_return_arc_labeling = values[2];
    if (values[3]) {
      __pyx_v_epsilon_on_replace = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_epsilon_on_replace == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1336, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1336
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 *                   bool epsilon_on_replace=False,             # <<<<<<<<<<<<<<
 *                   int64_t return_label=0):
 *   """
 */
      __pyx_v_epsilon_on_replace = ((bool)0);
    }
    if (values[4]) {
      __pyx_v_return_label = __Pyx_PyInt_As_int64_t(values[4]); if (unlikely((__pyx_v_return_label == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1337, __pyx_L3_error)
    } else {
      __pyx_v_return_label = ((int64_t)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1333, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_34replace(__pyx_self, __pyx_v_pairs, __pyx_v_call_arc_labeling, __pyx_v_return_arc_labeling, __pyx_v_epsilon_on_replace, __pyx_v_return_label);

  /* "_pynini.pyx":1333
 * 
 * 
 * cpdef Fst replace(pairs,             # <<<<<<<<<<<<<<
 *                   call_arc_labeling="input",
 *                   return_arc_labeling="neither",
 */

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

static PyObject *__pyx_pf_7_pynini_34replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_call_arc_labeling, PyObject *__pyx_v_return_arc_labeling, bool __pyx_v_epsilon_on_replace, int64_t __pyx_v_return_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_replace __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.call_arc_labeling = __pyx_v_call_arc_labeling;
  __pyx_t_2.return_arc_labeling = __pyx_v_return_arc_labeling;
  __pyx_t_2.epsilon_on_replace = __pyx_v_epsilon_on_replace;
  __pyx_t_2.return_label = __pyx_v_return_label;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_replace(__pyx_v_pairs, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1385
 * 
 * 
 * def union(*fsts):             # <<<<<<<<<<<<<<
 *   """
 *   union(*fsts)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_37union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_36union[] = "\n  union(*fsts)\n\n  Computes the union (sum) of two or more FSTs.\n\n  This operation computes the union (sum) of two FSTs. If A transduces string\n  x to y with weight a and B transduces string w to v with weight b, then their\n  union transduces x to y with weight a and w to v with weight b.\n\n  Args:\n   *fsts: Two or more input FSTs.\n\n  Returns:\n    An FST.\n  ";
static PyMethodDef __pyx_mdef_7_pynini_37union = {"union", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_37union, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_36union};
static PyObject *__pyx_pw_7_pynini_37union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fsts = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("union (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "union", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_fsts = __pyx_args;
  __pyx_r = __pyx_pf_7_pynini_36union(__pyx_self, __pyx_v_fsts);

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

static PyObject *__pyx_pf_7_pynini_36union(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fsts) {
  PyObject *__pyx_v_fst1 = NULL;
  PyObject *__pyx_v_fsts2 = NULL;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("union", 0);

  /* "_pynini.pyx":1401
 *     An FST.
 *   """
 *   (fst1, *fsts2) = fsts             # <<<<<<<<<<<<<<
 *   cdef Fst _fst1 = _compile_or_copy_Fst(fst1)
 *   return _fst1.union(*fsts2)
 */
  {
    Py_ssize_t index = -1;
    PyObject** temps[2] = {&__pyx_t_1};
    __pyx_t_2 = PyObject_GetIter(__pyx_v_fsts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext;
    for (index=0; index < 1; index++) {
      PyObject* item = __pyx_t_3(__pyx_t_2); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1401, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_4 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fst1 = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_fsts2 = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "_pynini.pyx":1402
 *   """
 *   (fst1, *fsts2) = fsts
 *   cdef Fst _fst1 = _compile_or_copy_Fst(fst1)             # <<<<<<<<<<<<<<
 *   return _fst1.union(*fsts2)
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst1, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "_pynini.pyx":1403
 *   (fst1, *fsts2) = fsts
 *   cdef Fst _fst1 = _compile_or_copy_Fst(fst1)
 *   return _fst1.union(*fsts2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v__fst1), __pyx_n_s_union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_fsts2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1385
 * 
 * 
 * def union(*fsts):             # <<<<<<<<<<<<<<
 *   """
 *   union(*fsts)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fst1);
  __Pyx_XDECREF(__pyx_v_fsts2);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1427
 *   cdef vector[pair[int64_t, int64_t]] _parens
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses___repr__(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses___repr__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 0);

  /* "_pynini.pyx":1428
 * 
 *   def __repr__(self):
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"             # <<<<<<<<<<<<<<
 * 
 *   def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__16);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__16);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__16);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_at_0x);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__3);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1427
 *   cdef vector[pair[int64_t, int64_t]] _parens
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.PdtParentheses.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1430
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __len__(self):             # <<<<<<<<<<<<<<
 *     return self._parens.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7_pynini_14PdtParentheses_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_7_pynini_14PdtParentheses_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_2__len__(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_7_pynini_14PdtParentheses_2__len__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "_pynini.pyx":1431
 * 
 *   def __len__(self):
 *     return self._parens.size()             # <<<<<<<<<<<<<<
 * 
 *   def __iter__(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1431, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_parens.size();
  goto __pyx_L0;

  /* "_pynini.pyx":1430
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __len__(self):             # <<<<<<<<<<<<<<
 *     return self._parens.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.PdtParentheses.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_14PdtParentheses_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":1433
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_4__iter__(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_4__iter__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)__pyx_tp_new_7_pynini___pyx_scope_struct_7___iter__(__pyx_ptype_7_pynini___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1433, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_14PdtParentheses_6generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PdtParentheses___iter, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

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

static PyObject *__pyx_gb_7_pynini_14PdtParentheses_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_1;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1433, __pyx_L1_error)

  /* "_pynini.pyx":1434
 * 
 *   def __iter__(self):
 *     cdef size_t _i = 0             # <<<<<<<<<<<<<<
 *     for _i in range(self._parens.size()):
 *       yield (self._parens[_i].first, self._parens[_i].second)
 */
  __pyx_cur_scope->__pyx_v__i = 0;

  /* "_pynini.pyx":1435
 *   def __iter__(self):
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):             # <<<<<<<<<<<<<<
 *       yield (self._parens[_i].first, self._parens[_i].second)
 * 
 */
  if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1435, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_parens.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v__i = __pyx_t_3;

    /* "_pynini.pyx":1436
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 *       yield (self._parens[_i].first, self._parens[_i].second)             # <<<<<<<<<<<<<<
 * 
 *   cpdef PdtParentheses copy(self):
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
      __PYX_ERR(0, 1436, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyInt_From_int64_t((__pyx_cur_scope->__pyx_v_self->_parens[__pyx_cur_scope->__pyx_v__i]).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
      __PYX_ERR(0, 1436, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyInt_From_int64_t((__pyx_cur_scope->__pyx_v_self->_parens[__pyx_cur_scope->__pyx_v__i]).second); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1436, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":1433
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1438
 *       yield (self._parens[_i].first, self._parens[_i].second)
 * 
 *   cpdef PdtParentheses copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

static PyObject *__pyx_pw_7_pynini_14PdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_7_pynini_PdtParentheses *__pyx_f_7_pynini_14PdtParentheses_copy(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__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;
  std::vector<std::pair<int64_t,int64_t> >  __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_14PdtParentheses_8copy)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_PdtParentheses))))) __PYX_ERR(0, 1438, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1447
 *       A deep copy of the PdtParentheses object.
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)             # <<<<<<<<<<<<<<
 *     result._parens = self._parens
 *     return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_PdtParentheses(((PyTypeObject *)__pyx_ptype_7_pynini_PdtParentheses), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1448
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     result._parens = self._parens             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1448, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_v_self->_parens;
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1448, __pyx_L1_error)
  }
  __pyx_v_result->_parens = __pyx_t_5;

  /* "_pynini.pyx":1449
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     result._parens = self._parens
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   cpdef void add_pair(self, int64_t push, int64_t pop):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1438
 *       yield (self._parens[_i].first, self._parens[_i].second)
 * 
 *   cpdef PdtParentheses copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

  /* 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("_pynini.PdtParentheses.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_14PdtParentheses_7copy[] = "\n    copy(self)\n\n    Makes a copy of this PdtParentheses object.\n\n    Returns:\n      A deep copy of the PdtParentheses object.\n    ";
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_7copy(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_7copy(struct __pyx_obj_7_pynini_PdtParentheses *__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("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_14PdtParentheses_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1451
 *     return result
 * 
 *   cpdef void add_pair(self, int64_t push, int64_t pop):             # <<<<<<<<<<<<<<
 *     """
 *     add_pair(self, push, pop)
 */

static PyObject *__pyx_pw_7_pynini_14PdtParentheses_10add_pair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static void __pyx_f_7_pynini_14PdtParentheses_add_pair(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  std::pair<int64_t,int64_t>  __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_pair", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_pair); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_14PdtParentheses_10add_pair)) {
        __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_push); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1451, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1451, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        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_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1451, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1451, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1451, __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_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1451, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __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;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1461
 *       pop: An arc label to be interpreted as a "pop" operation.
 *     """
 *     self._parens.push_back(pair[int64_t, int64_t](push, pop))             # <<<<<<<<<<<<<<
 * 
 *   @classmethod
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1461, __pyx_L1_error)
  }
  try {
    __pyx_t_9 = std::pair<int64_t,int64_t> (__pyx_v_push, __pyx_v_pop);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1461, __pyx_L1_error)
  }
  try {
    __pyx_v_self->_parens.push_back(__pyx_t_9);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1461, __pyx_L1_error)
  }

  /* "_pynini.pyx":1451
 *     return result
 * 
 *   cpdef void add_pair(self, int64_t push, int64_t pop):             # <<<<<<<<<<<<<<
 *     """
 *     add_pair(self, push, pop)
 */

  /* function exit 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);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("_pynini.PdtParentheses.add_pair", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_10add_pair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_14PdtParentheses_9add_pair[] = "\n    add_pair(self, push, pop)\n\n    Adds a pair of parentheses to the set.\n\n    Args:\n      push: An arc label to be interpreted as a \"push\" operation.\n      pop: An arc label to be interpreted as a \"pop\" operation.\n    ";
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_10add_pair(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int64_t __pyx_v_push;
  int64_t __pyx_v_pop;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_pair (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_push,&__pyx_n_s_pop,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_push)) != 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_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_pair", 1, 2, 2, 1); __PYX_ERR(0, 1451, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_pair") < 0)) __PYX_ERR(0, 1451, __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_push = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_push == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L3_error)
    __pyx_v_pop = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_pop == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_pair", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1451, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.PdtParentheses.add_pair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_9add_pair(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self), __pyx_v_push, __pyx_v_pop);

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_9add_pair(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop) {
  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("add_pair", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_14PdtParentheses_add_pair(__pyx_v_self, __pyx_v_push, __pyx_v_pop, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1464
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     PdtParentheses.read(filename)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_12read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_7_pynini_14PdtParentheses_11read[] = "\n    PdtParentheses.read(filename)\n\n    Reads parentheses pairs from a text file.\n\n    This class method creates a new PdtParentheses object from a pairs of\n    integer labels in a text file.\n\n    Args:\n      filename: The string location of the input file.\n\n    Returns:\n      A new PdtParentheses instance.\n\n    Raises:\n      FstIOError: Read failed.\n    ";
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_12read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_11read(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_11read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::string __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "_pynini.pyx":1482
 *       FstIOError: Read failed.
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)             # <<<<<<<<<<<<<<
 *     if not ReadLabelPairs[int64_t](path_tostring(filename),
 *                                  addr(result._parens),
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_PdtParentheses(((PyTypeObject *)__pyx_ptype_7_pynini_PdtParentheses), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1483
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     if not ReadLabelPairs[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                  addr(result._parens),
 *                                  False):
 */
  __pyx_t_2 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L1_error)

  /* "_pynini.pyx":1484
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     if not ReadLabelPairs[int64_t](path_tostring(filename),
 *                                  addr(result._parens),             # <<<<<<<<<<<<<<
 *                                  False):
 *       raise FstIOError(f"Read failed: {filename}")
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1484, __pyx_L1_error)
  }

  /* "_pynini.pyx":1483
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     if not ReadLabelPairs[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                  addr(result._parens),
 *                                  False):
 */
  __pyx_t_3 = ((!(fst::ReadLabelPairs<int64_t>(__pyx_t_2, (&__pyx_v_result->_parens), 0) != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "_pynini.pyx":1486
 *                                  addr(result._parens),
 *                                  False):
 *       raise FstIOError(f"Read failed: {filename}")             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Read_failed_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1486, __pyx_L1_error)

    /* "_pynini.pyx":1483
 *     """
 *     cdef PdtParentheses result = PdtParentheses.__new__(PdtParentheses)
 *     if not ReadLabelPairs[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                  addr(result._parens),
 *                                  False):
 */
  }

  /* "_pynini.pyx":1487
 *                                  False):
 *       raise FstIOError(f"Read failed: {filename}")
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   cpdef void write(self, filename) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":1464
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     PdtParentheses.read(filename)
 */

  /* 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_AddTraceback("_pynini.PdtParentheses.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1489
 *     return result
 * 
 *   cpdef void write(self, filename) except *:             # <<<<<<<<<<<<<<
 *     """
 *     write(self, filename)
 */

static PyObject *__pyx_pw_7_pynini_14PdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static void __pyx_f_7_pynini_14PdtParentheses_write(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_14PdtParentheses_14write)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1489, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1503
 *       FstIOError: Write failed.
 *     """
 *     if not WriteLabelPairs[int64_t](path_tostring(filename), self._parens):             # <<<<<<<<<<<<<<
 *       raise FstIOError(f"Write failed: {filename}")
 * 
 */
  __pyx_t_5 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1503, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1503, __pyx_L1_error)
  }
  __pyx_t_6 = ((!(fst::WriteLabelPairs<int64_t>(__pyx_t_5, __pyx_v_self->_parens) != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "_pynini.pyx":1504
 *     """
 *     if not WriteLabelPairs[int64_t](path_tostring(filename), self._parens):
 *       raise FstIOError(f"Write failed: {filename}")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Write_failed, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1504, __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, 1504, __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, 1504, __pyx_L1_error)

    /* "_pynini.pyx":1503
 *       FstIOError: Write failed.
 *     """
 *     if not WriteLabelPairs[int64_t](path_tostring(filename), self._parens):             # <<<<<<<<<<<<<<
 *       raise FstIOError(f"Write failed: {filename}")
 * 
 */
  }

  /* "_pynini.pyx":1489
 *     return result
 * 
 *   cpdef void write(self, filename) except *:             # <<<<<<<<<<<<<<
 *     """
 *     write(self, filename)
 */

  /* function exit 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_AddTraceback("_pynini.PdtParentheses.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_7_pynini_14PdtParentheses_13write[] = "\n    write(self, filename)\n\n    Writes parentheses pairs to text file.\n\n    This method writes the PdtParentheses object to a text file.\n\n    Args:\n      filename: The string location of the output file.\n\n    Raises:\n      FstIOError: Write failed.\n    ";
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_13write(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_13write(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_f_7_pynini_14PdtParentheses_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1489, __pyx_L1_error)
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

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

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_16__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_16__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_15__reduce_cython__(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self));

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

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

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._parens,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(__pyx_v_self->_parens); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __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_v_state = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

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

  /* "(tree fragment)":7
 *     state = (self._parens,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

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

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

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

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, None), state
 *     else:
 */
  __pyx_t_4 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_4) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_PdtParentheses); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_7916983);
    __Pyx_GIVEREF(__pyx_int_7916983);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_7916983);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, None), state
 *     else:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_PdtParentheses__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_PdtParentheses); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_7916983);
    __Pyx_GIVEREF(__pyx_int_7916983);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_7916983);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

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

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

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_PdtParentheses__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_18__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_14PdtParentheses_18__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_14PdtParentheses_17__setstate_cython__(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7_pynini_14PdtParentheses_17__setstate_cython__(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_PdtParentheses__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7_pynini___pyx_unpickle_PdtParentheses__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_PdtParentheses, (type(self), 0x078cdb7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_PdtParentheses__set_state(self, __pyx_state)
 */

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

/* "_pynini.pyx":1507
 * 
 * 
 * def pdt_compose(fst1,             # <<<<<<<<<<<<<<
 *                 fst2,
 *                 PdtParentheses parens,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_39pdt_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_38pdt_compose[] = "\n  pdt_compose(fst1, fst2, parens, compose_filter=\"paren\", left_pdt=True)\n\n  Composes a PDT with an FST.\n\n  This operation composes a PDT with an FST. The input PDT is defined by the\n  combination of an FST and a PdtParentheses object specifying the stack\n  symbols. The caller should also specify whether the left-hand or the\n  right-hand FST argument is to be interpreted as a PDT.\n\n  Args:\n    fst1: The left-hand-side input FST or PDT.\n    fst2: The right-hand-side input FST or PDT.\n    parens: A PdtParentheses object specifying the input PDT's stack symbols.\n    compose_filter: A string indicating the desired PDT composition filter; one\n        of: \"paren\" (keeps parentheses), \"expand\" (expands and removes\n        parentheses), \"expand_paren\" (expands and keeps parentheses).\n    left_pdt: If true, the first argument is interpreted as a PDT and the\n        second argument is interpreted as an FST; if false, the second\n        argument is interpreted as a PDT and the first argument is interpreted\n        as an FST.\n\n  Returns:\n    The FST component of an PDT produced by composition.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyMethodDef __pyx_mdef_7_pynini_39pdt_compose = {"pdt_compose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_39pdt_compose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_38pdt_compose};
static PyObject *__pyx_pw_7_pynini_39pdt_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens = 0;
  PyObject *__pyx_v_compose_filter = 0;
  bool __pyx_v_left_pdt;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pdt_compose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,&__pyx_n_s_parens,&__pyx_n_s_compose_filter,&__pyx_n_s_left_pdt,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_u_paren);
    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_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pdt_compose", 0, 3, 5, 1); __PYX_ERR(0, 1507, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pdt_compose", 0, 3, 5, 2); __PYX_ERR(0, 1507, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter);
          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_left_pdt);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdt_compose") < 0)) __PYX_ERR(0, 1507, __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);
        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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_PdtParentheses *)values[2]);
    __pyx_v_compose_filter = values[3];
    if (values[4]) {
      __pyx_v_left_pdt = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_left_pdt == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1511, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1511
 *                 PdtParentheses parens,
 *                 compose_filter="paren",
 *                 bool left_pdt=True):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_compose(fst1, fst2, parens, compose_filter="paren", left_pdt=True)
 */
      __pyx_v_left_pdt = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pdt_compose", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1507, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.pdt_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_PdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1509, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_38pdt_compose(__pyx_self, __pyx_v_fst1, __pyx_v_fst2, __pyx_v_parens, __pyx_v_compose_filter, __pyx_v_left_pdt);

  /* "_pynini.pyx":1507
 * 
 * 
 * def pdt_compose(fst1,             # <<<<<<<<<<<<<<
 *                 fst2,
 *                 PdtParentheses parens,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_38pdt_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, PyObject *__pyx_v_compose_filter, bool __pyx_v_left_pdt) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  fst::PdtComposeFilter __pyx_v__compose_filter;
  std::unique_ptr<fst::PdtComposeOptions>  __pyx_v__opts;
  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 *);
  std::string __pyx_t_6;
  fst::PdtComposeFilter __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pdt_compose", 0);

  /* "_pynini.pyx":1542
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *   cdef Fst result = Fst(_fst1.arc_type())
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1542, __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, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1542, __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, 1542, __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, 1542, __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, 1542, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1542, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1542, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1543
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   cdef PdtComposeFilter _compose_filter = _get_pdt_compose_filter(
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1543, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1543, __pyx_L1_error)
  }
  __pyx_f_7_pynini__maybe_arcsort(__pyx_v__fst1->__pyx_base.__pyx_base._mfst.get(), __pyx_v__fst2->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":1544
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *   cdef Fst result = Fst(_fst1.arc_type())             # <<<<<<<<<<<<<<
 *   cdef PdtComposeFilter _compose_filter = _get_pdt_compose_filter(
 *       tostring(compose_filter))
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1544, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst1), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1546
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   cdef PdtComposeFilter _compose_filter = _get_pdt_compose_filter(
 *       tostring(compose_filter))             # <<<<<<<<<<<<<<
 *   cdef unique_ptr[PdtComposeOptions] _opts
 *   _opts.reset(new PdtComposeOptions(True, _compose_filter))
 */
  __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1546, __pyx_L1_error)

  /* "_pynini.pyx":1545
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   cdef PdtComposeFilter _compose_filter = _get_pdt_compose_filter(             # <<<<<<<<<<<<<<
 *       tostring(compose_filter))
 *   cdef unique_ptr[PdtComposeOptions] _opts
 */
  __pyx_t_7 = __pyx_f_7_pynini__get_pdt_compose_filter(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1545, __pyx_L1_error)
  __pyx_v__compose_filter = __pyx_t_7;

  /* "_pynini.pyx":1548
 *       tostring(compose_filter))
 *   cdef unique_ptr[PdtComposeOptions] _opts
 *   _opts.reset(new PdtComposeOptions(True, _compose_filter))             # <<<<<<<<<<<<<<
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),
 */
  __pyx_v__opts.reset(new fst::PdtComposeOptions(1, __pyx_v__compose_filter));

  /* "_pynini.pyx":1549
 *   cdef unique_ptr[PdtComposeOptions] _opts
 *   _opts.reset(new PdtComposeOptions(True, _compose_filter))
 *   Compose(deref(_fst1._fst),             # <<<<<<<<<<<<<<
 *           deref(_fst2._fst),
 *           parens._parens,
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1549, __pyx_L1_error)
  }

  /* "_pynini.pyx":1550
 *   _opts.reset(new PdtComposeOptions(True, _compose_filter))
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),             # <<<<<<<<<<<<<<
 *           parens._parens,
 *           result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1550, __pyx_L1_error)
  }

  /* "_pynini.pyx":1551
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),
 *           parens._parens,             # <<<<<<<<<<<<<<
 *           result._mfst.get(),
 *           deref(_opts),
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1551, __pyx_L1_error)
  }

  /* "_pynini.pyx":1549
 *   cdef unique_ptr[PdtComposeOptions] _opts
 *   _opts.reset(new PdtComposeOptions(True, _compose_filter))
 *   Compose(deref(_fst1._fst),             # <<<<<<<<<<<<<<
 *           deref(_fst2._fst),
 *           parens._parens,
 */
  fst::script::Compose((*__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__fst2->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts), __pyx_v_left_pdt);

  /* "_pynini.pyx":1555
 *           deref(_opts),
 *           left_pdt)
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":1507
 * 
 * 
 * def pdt_compose(fst1,             # <<<<<<<<<<<<<<
 *                 fst2,
 *                 PdtParentheses parens,
 */

  /* 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("_pynini.pdt_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1558
 * 
 * 
 * def pdt_expand(fst,             # <<<<<<<<<<<<<<
 *                PdtParentheses parens,
 *                bool connect=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_41pdt_expand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_40pdt_expand[] = "\n  pdt_expand(fst, parens, connect=True, keep_parentheses=False, weight=None)\n\n  Expands a bounded-stack PDT to an FST.\n\n  This operation converts a bounded-stack PDT into the equivalent FST. The\n  input PDT is defined by the combination of an FST and a PdtParentheses object\n  specifying the PDT stack symbols.\n\n  If the input PDT does not have a bounded stack, then it is impossible to\n  expand the PDT into an FST and this operation will not terminate.\n\n  Args:\n    fst: The FST component of the input PDT.\n    parens: A PdtParentheses object specifying the input PDT's stack symbols.\n    connect: Should the output FST be trimmed?\n    keep_parentheses: Should the output FST preserve parentheses arcs?\n    weight: A Weight or weight string indicating the desired weight threshold;\n        paths with weights below this threshold will be pruned. If omitted or\n        null, no paths are pruned.\n\n  Returns:\n    An FST produced by expanding the bounded-stack PDT.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyMethodDef __pyx_mdef_7_pynini_41pdt_expand = {"pdt_expand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_41pdt_expand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_40pdt_expand};
static PyObject *__pyx_pw_7_pynini_41pdt_expand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens = 0;
  bool __pyx_v_connect;
  bool __pyx_v_keep_parentheses;
  PyObject *__pyx_v_weight = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pdt_expand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_parens,&__pyx_n_s_connect,&__pyx_n_s_keep_parentheses,&__pyx_n_s_weight,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "_pynini.pyx":1562
 *                bool connect=True,
 *                bool keep_parentheses=False,
 *                weight=None):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_expand(fst, parens, connect=True, keep_parentheses=False, weight=None)
 */
    values[4] = ((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  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_fst)) != 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_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pdt_expand", 0, 2, 5, 1); __PYX_ERR(0, 1558, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect);
          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_keep_parentheses);
          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_weight);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdt_expand") < 0)) __PYX_ERR(0, 1558, __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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fst = values[0];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_PdtParentheses *)values[1]);
    if (values[2]) {
      __pyx_v_connect = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1560
 * def pdt_expand(fst,
 *                PdtParentheses parens,
 *                bool connect=True,             # <<<<<<<<<<<<<<
 *                bool keep_parentheses=False,
 *                weight=None):
 */
      __pyx_v_connect = ((bool)1);
    }
    if (values[3]) {
      __pyx_v_keep_parentheses = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_keep_parentheses == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1561, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1561
 *                PdtParentheses parens,
 *                bool connect=True,
 *                bool keep_parentheses=False,             # <<<<<<<<<<<<<<
 *                weight=None):
 *   """
 */
      __pyx_v_keep_parentheses = ((bool)0);
    }
    __pyx_v_weight = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pdt_expand", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1558, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.pdt_expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_PdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1559, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_40pdt_expand(__pyx_self, __pyx_v_fst, __pyx_v_parens, __pyx_v_connect, __pyx_v_keep_parentheses, __pyx_v_weight);

  /* "_pynini.pyx":1558
 * 
 * 
 * def pdt_expand(fst,             # <<<<<<<<<<<<<<
 *                PdtParentheses parens,
 *                bool connect=True,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_40pdt_expand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, bool __pyx_v_connect, bool __pyx_v_keep_parentheses, PyObject *__pyx_v_weight) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  fst::script::WeightClass __pyx_v__weight;
  std::unique_ptr<fst::script::PdtExpandOptions>  __pyx_v__opts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  fst::script::WeightClass __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pdt_expand", 0);

  /* "_pynini.pyx":1590
 *     FstOpError: Operation failed.
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef WeightClass _weight = _get_WeightClass_or_zero(result.weight_type(),
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1591
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())             # <<<<<<<<<<<<<<
 *   cdef WeightClass _weight = _get_WeightClass_or_zero(result.weight_type(),
 *                                                       weight)
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1591, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1592
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef WeightClass _weight = _get_WeightClass_or_zero(result.weight_type(),             # <<<<<<<<<<<<<<
 *                                                       weight)
 *   cdef unique_ptr[PdtExpandOptions] _opts
 */
  __pyx_t_3 = __pyx_f_10_pywrapfst__get_WeightClass_or_zero(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.weight_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_result), 0), __pyx_v_weight); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1592, __pyx_L1_error)
  __pyx_v__weight = __pyx_t_3;

  /* "_pynini.pyx":1595
 *                                                       weight)
 *   cdef unique_ptr[PdtExpandOptions] _opts
 *   _opts.reset(new PdtExpandOptions(connect, keep_parentheses, _weight))             # <<<<<<<<<<<<<<
 *   Expand(deref(_fst._fst), parens._parens, result._mfst.get(), deref(_opts))
 *   result._check_mutating_imethod()
 */
  __pyx_v__opts.reset(new fst::script::PdtExpandOptions(__pyx_v_connect, __pyx_v_keep_parentheses, __pyx_v__weight));

  /* "_pynini.pyx":1596
 *   cdef unique_ptr[PdtExpandOptions] _opts
 *   _opts.reset(new PdtExpandOptions(connect, keep_parentheses, _weight))
 *   Expand(deref(_fst._fst), parens._parens, result._mfst.get(), deref(_opts))             # <<<<<<<<<<<<<<
 *   result._check_mutating_imethod()
 *   return result
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1596, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1596, __pyx_L1_error)
  }
  fst::script::Expand((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts));

  /* "_pynini.pyx":1597
 *   _opts.reset(new PdtExpandOptions(connect, keep_parentheses, _weight))
 *   Expand(deref(_fst._fst), parens._parens, result._mfst.get(), deref(_opts))
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1597, __pyx_L1_error)

  /* "_pynini.pyx":1598
 *   Expand(deref(_fst._fst), parens._parens, result._mfst.get(), deref(_opts))
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":1558
 * 
 * 
 * def pdt_expand(fst,             # <<<<<<<<<<<<<<
 *                PdtParentheses parens,
 *                bool connect=True,
 */

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

/* "_pynini.pyx":1604
 * 
 * 
 * cdef object _pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                          pdt_parser_type="left",
 *                          int64_t start_paren_labels=kNoLabel,
 */

static PyObject *__pyx_f_7_pynini__pdt_replace(PyObject *__pyx_v_pairs, struct __pyx_opt_args_7_pynini__pdt_replace *__pyx_optional_args) {
  PyObject *__pyx_v_pdt_parser_type = ((PyObject *)__pyx_n_u_left);
  int64_t __pyx_v_start_paren_labels = __pyx_k__17;
  PyObject *__pyx_v_left_paren_prefix = ((PyObject *)__pyx_kp_u__18);
  PyObject *__pyx_v_right_paren_prefix = ((PyObject *)__pyx_kp_u__19);
  std::vector<__pyx_t_10cpywrapfst_LabelFstClassPair>  __pyx_v__pairs;
  int64_t __pyx_v__label;
  struct __pyx_obj_10_pywrapfst_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result_fst = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_result_parens = 0;
  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;
  PyObject *(*__pyx_t_8)(PyObject *);
  int64_t __pyx_t_9;
  __pyx_t_10cpywrapfst_LabelFstClassPair __pyx_t_10;
  std::string __pyx_t_11;
  fst::PdtParserType __pyx_t_12;
  std::string __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pdt_replace", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_pdt_parser_type = __pyx_optional_args->pdt_parser_type;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_start_paren_labels = __pyx_optional_args->start_paren_labels;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_left_paren_prefix = __pyx_optional_args->left_paren_prefix;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_right_paren_prefix = __pyx_optional_args->right_paren_prefix;
          }
        }
      }
    }
  }

  /* "_pynini.pyx":1612
 *   cdef int64_t _label
 *   cdef _Fst _fst
 *   for (_label, _fst) in pairs:             # <<<<<<<<<<<<<<
 *     _pairs.push_back(LabelFstClassPair(_label, _fst._fst.get()))
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())
 */
  if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
    __pyx_t_1 = __pyx_v_pairs; __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_pairs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1612, __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, 1612, __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, 1612, __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, 1612, __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, 1612, __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, 1612, __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, 1612, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      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, 1612, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_t_9 = __Pyx_PyInt_As_int64_t(__pyx_t_5); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_10_pywrapfst_Fst))))) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_v__label = __pyx_t_9;
    __Pyx_XDECREF_SET(__pyx_v__fst, ((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "_pynini.pyx":1613
 *   cdef _Fst _fst
 *   for (_label, _fst) in pairs:
 *     _pairs.push_back(LabelFstClassPair(_label, _fst._fst.get()))             # <<<<<<<<<<<<<<
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())
 *   cdef PdtParentheses result_parens = PdtParentheses()
 */
    if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
      __PYX_ERR(0, 1613, __pyx_L1_error)
    }
    try {
      __pyx_t_10 = __pyx_t_10cpywrapfst_LabelFstClassPair(__pyx_v__label, __pyx_v__fst->_fst.get());
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1613, __pyx_L1_error)
    }
    try {
      __pyx_v__pairs.push_back(__pyx_t_10);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1613, __pyx_L1_error)
    }

    /* "_pynini.pyx":1612
 *   cdef int64_t _label
 *   cdef _Fst _fst
 *   for (_label, _fst) in pairs:             # <<<<<<<<<<<<<<
 *     _pairs.push_back(LabelFstClassPair(_label, _fst._fst.get()))
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1614
 *   for (_label, _fst) in pairs:
 *     _pairs.push_back(LabelFstClassPair(_label, _fst._fst.get()))
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())             # <<<<<<<<<<<<<<
 *   cdef PdtParentheses result_parens = PdtParentheses()
 *   Replace(_pairs,
 */
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string((__pyx_v__pairs[0]).second->ArcType()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result_fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "_pynini.pyx":1615
 *     _pairs.push_back(LabelFstClassPair(_label, _fst._fst.get()))
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())
 *   cdef PdtParentheses result_parens = PdtParentheses()             # <<<<<<<<<<<<<<
 *   Replace(_pairs,
 *           result_fst._mfst.get(),
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7_pynini_PdtParentheses)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_result_parens = ((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "_pynini.pyx":1620
 *           addr(result_parens._parens),
 *           _pairs[0].first,
 *           _get_pdt_parser_type(tostring(pdt_parser_type)),             # <<<<<<<<<<<<<<
 *           start_paren_labels,
 *           tostring(left_paren_prefix),
 */
  __pyx_t_11 = __pyx_f_10_pywrapfst_tostring(__pyx_v_pdt_parser_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1620, __pyx_L1_error)
  __pyx_t_12 = __pyx_f_7_pynini__get_pdt_parser_type(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1620, __pyx_L1_error)

  /* "_pynini.pyx":1622
 *           _get_pdt_parser_type(tostring(pdt_parser_type)),
 *           start_paren_labels,
 *           tostring(left_paren_prefix),             # <<<<<<<<<<<<<<
 *           tostring(right_paren_prefix))
 *   result_fst._check_mutating_imethod()
 */
  __pyx_t_11 = __pyx_f_10_pywrapfst_tostring(__pyx_v_left_paren_prefix); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L1_error)

  /* "_pynini.pyx":1623
 *           start_paren_labels,
 *           tostring(left_paren_prefix),
 *           tostring(right_paren_prefix))             # <<<<<<<<<<<<<<
 *   result_fst._check_mutating_imethod()
 *   return (result_fst, result_parens)
 */
  __pyx_t_13 = __pyx_f_10_pywrapfst_tostring(__pyx_v_right_paren_prefix); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1623, __pyx_L1_error)

  /* "_pynini.pyx":1616
 *   cdef Fst result_fst = Fst(_pairs[0].second.ArcType())
 *   cdef PdtParentheses result_parens = PdtParentheses()
 *   Replace(_pairs,             # <<<<<<<<<<<<<<
 *           result_fst._mfst.get(),
 *           addr(result_parens._parens),
 */
  fst::script::Replace(__pyx_v__pairs, __pyx_v_result_fst->__pyx_base.__pyx_base._mfst.get(), (&__pyx_v_result_parens->_parens), (__pyx_v__pairs[0]).first, __pyx_t_12, __pyx_v_start_paren_labels, __pyx_t_11, __pyx_t_13);

  /* "_pynini.pyx":1624
 *           tostring(left_paren_prefix),
 *           tostring(right_paren_prefix))
 *   result_fst._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return (result_fst, result_parens)
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result_fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result_fst)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1624, __pyx_L1_error)

  /* "_pynini.pyx":1625
 *           tostring(right_paren_prefix))
 *   result_fst._check_mutating_imethod()
 *   return (result_fst, result_parens)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_result_fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result_fst));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_result_fst));
  __Pyx_INCREF(((PyObject *)__pyx_v_result_parens));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result_parens));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_result_parens));
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1604
 * 
 * 
 * cdef object _pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                          pdt_parser_type="left",
 *                          int64_t start_paren_labels=kNoLabel,
 */

  /* 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("_pynini._pdt_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_parens);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1628
 * 
 * 
 * def pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                 pdt_parser_type="left",
 *                 int64_t start_paren_labels=kNoLabel,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_43pdt_replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_42pdt_replace[] = "\n  pdt_replace(pairs, pdt_parser_type=\"left\",\n              int64_t start_paren_labels=NO_LABEL,\n              left_paren_prefix=\"(_\",\n              right_paren_prefix=\")_\")\n\n  Constructively replaces arcs in an FST with other FST(s), producing a PDT.\n\n  This operation performs the dynamic replacement of arcs in one FST with\n  another FST, allowing the definition of a PDT analogues to RTNs. The output\n  PDT, defined by the combination of an FST and a PdtParentheses object\n  specifying the PDT stack symbols, is the result of recursively replacing each\n  arc in an input FST that matches some \"non-terminal\" with a corresponding\n  FST, inserting parentheses where necessary. More precisely, an arc from\n  state s to state d with nonterminal output label n in an input FST is\n  replaced by redirecting this \"call\" arc to the initial state of a copy of the\n  replacement FST and then adding \"return\" arcs from each final state of the\n  replacement FST to d in the input FST. Unlike `replace`, this operation is\n  capable of handling cyclic dependencies among replacement rules, which is\n  accomplished by adding \"push\" stack symbols to \"call\" arcs and \"pop\" stack\n  symbols to \"return\" arcs.\n\n  Args:\n    pairs: An iterable of (nonterminal label, FST) pairs, where the former is an\n        unsigned integer and the latter is an Fst instance.\n    pdt_parser_type: A string matching a known PdtParserType. One of: \"left\"\n        (default), \"left_sr\".\n    start_paren_labels: Index to use for the first inserted parentheses.\n    left_paren_prefix: Prefix to attach to SymbolTable labels for inserted left\n        parentheses.\n    right_paren_prefix: Prefix to attach to SymbolTable labels for inserted\n        right parentheses.\n\n  Returns:\n   An (Fst, PdtParentheses) pair.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyMethodDef __pyx_mdef_7_pynini_43pdt_replace = {"pdt_replace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_43pdt_replace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_42pdt_replace};
static PyObject *__pyx_pw_7_pynini_43pdt_replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pairs = 0;
  PyObject *__pyx_v_pdt_parser_type = 0;
  int64_t __pyx_v_start_paren_labels;
  PyObject *__pyx_v_left_paren_prefix = 0;
  PyObject *__pyx_v_right_paren_prefix = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pdt_replace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pairs,&__pyx_n_s_pdt_parser_type,&__pyx_n_s_start_paren_labels,&__pyx_n_s_left_paren_prefix,&__pyx_n_s_right_paren_prefix,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_left);
    values[3] = ((PyObject *)__pyx_kp_u__18);
    values[4] = ((PyObject *)__pyx_kp_u__19);
    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_pairs)) != 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_pdt_parser_type);
          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_start_paren_labels);
          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_left_paren_prefix);
          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_right_paren_prefix);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdt_replace") < 0)) __PYX_ERR(0, 1628, __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_pairs = values[0];
    __pyx_v_pdt_parser_type = values[1];
    if (values[2]) {
      __pyx_v_start_paren_labels = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_start_paren_labels == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1630, __pyx_L3_error)
    } else {
      __pyx_v_start_paren_labels = __pyx_k__20;
    }
    __pyx_v_left_paren_prefix = values[3];
    __pyx_v_right_paren_prefix = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pdt_replace", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1628, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.pdt_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_42pdt_replace(__pyx_self, __pyx_v_pairs, __pyx_v_pdt_parser_type, __pyx_v_start_paren_labels, __pyx_v_left_paren_prefix, __pyx_v_right_paren_prefix);

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

static PyObject *__pyx_pf_7_pynini_42pdt_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pairs, PyObject *__pyx_v_pdt_parser_type, int64_t __pyx_v_start_paren_labels, PyObject *__pyx_v_left_paren_prefix, PyObject *__pyx_v_right_paren_prefix) {
  PyObject *__pyx_8genexpr3__pyx_v_label = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_fst = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  struct __pyx_opt_args_7_pynini__pdt_replace __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pdt_replace", 0);
  __Pyx_INCREF(__pyx_v_pairs);

  /* "_pynini.pyx":1673
 *   """
 *   # Keeps these in memory so they're not garbage-collected.
 *   pairs = [(label, _compile_or_copy_Fst(fst)) for (label, fst) in pairs]             # <<<<<<<<<<<<<<
 *   return _pdt_replace(pairs,
 *                       pdt_parser_type,
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1673, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
      __pyx_t_2 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1673, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1673, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1673, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1673, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1673, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1673, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1673, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      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, 1673, __pyx_L5_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_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1673, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1673, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        #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, 1673, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 1673, __pyx_L5_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1673, __pyx_L5_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_label, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_fst, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_5 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_8genexpr3__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1673, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1673, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_8genexpr3__pyx_v_label);
      __Pyx_GIVEREF(__pyx_8genexpr3__pyx_v_label);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_8genexpr3__pyx_v_label);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1673, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_fst); __pyx_8genexpr3__pyx_v_fst = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_label); __pyx_8genexpr3__pyx_v_label = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_fst); __pyx_8genexpr3__pyx_v_fst = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_label); __pyx_8genexpr3__pyx_v_label = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_pairs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1674
 *   # Keeps these in memory so they're not garbage-collected.
 *   pairs = [(label, _compile_or_copy_Fst(fst)) for (label, fst) in pairs]
 *   return _pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                       pdt_parser_type,
 *                       start_paren_labels,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "_pynini.pyx":1678
 *                       start_paren_labels,
 *                       left_paren_prefix,
 *                       right_paren_prefix)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_10.__pyx_n = 4;
  __pyx_t_10.pdt_parser_type = __pyx_v_pdt_parser_type;
  __pyx_t_10.start_paren_labels = __pyx_v_start_paren_labels;
  __pyx_t_10.left_paren_prefix = __pyx_v_left_paren_prefix;
  __pyx_t_10.right_paren_prefix = __pyx_v_right_paren_prefix;
  __pyx_t_1 = __pyx_f_7_pynini__pdt_replace(__pyx_v_pairs, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1628
 * 
 * 
 * def pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                 pdt_parser_type="left",
 *                 int64_t start_paren_labels=kNoLabel,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_pynini.pdt_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_label);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_fst);
  __Pyx_XDECREF(__pyx_v_pairs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1681
 * 
 * 
 * cpdef Fst pdt_reverse(fst, PdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_reverse(fst, parens)
 */

static PyObject *__pyx_pw_7_pynini_45pdt_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_pdt_reverse(PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_Fst *__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("pdt_reverse", 0);

  /* "_pynini.pyx":1697
 *     An FST.
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst.arc_type())
 *   Reverse(deref(_fst._fst), parens._parens, result._mfst.get())
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1698
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())             # <<<<<<<<<<<<<<
 *   Reverse(deref(_fst._fst), parens._parens, result._mfst.get())
 *   result._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1698, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1699
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())
 *   Reverse(deref(_fst._fst), parens._parens, result._mfst.get())             # <<<<<<<<<<<<<<
 *   result._check_mutating_imethod()
 *   return result
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1699, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1699, __pyx_L1_error)
  }
  fst::script::Reverse((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_result->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":1700
 *   cdef Fst result = Fst(_fst.arc_type())
 *   Reverse(deref(_fst._fst), parens._parens, result._mfst.get())
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1700, __pyx_L1_error)

  /* "_pynini.pyx":1701
 *   Reverse(deref(_fst._fst), parens._parens, result._mfst.get())
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1681
 * 
 * 
 * cpdef Fst pdt_reverse(fst, PdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_reverse(fst, parens)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.pdt_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_45pdt_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_44pdt_reverse[] = "\n  pdt_reverse(fst, parens)\n\n  Reverses a PDT.\n\n  This operation reverses an PDT. The input PDT is defined by the combination\n  of an FST and a PdtParentheses object specifying the PDT stack symbols.\n\n  Args:\n    fst: The FST component of the input PDT.\n    parens: A PdtParentheses object specifying the input PDT's stack symbols.\n\n  Returns:\n    An FST.\n  ";
static PyObject *__pyx_pw_7_pynini_45pdt_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pdt_reverse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_parens,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_fst)) != 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_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pdt_reverse", 1, 2, 2, 1); __PYX_ERR(0, 1681, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdt_reverse") < 0)) __PYX_ERR(0, 1681, __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_fst = values[0];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_PdtParentheses *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pdt_reverse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.pdt_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_PdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1681, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_44pdt_reverse(__pyx_self, __pyx_v_fst, __pyx_v_parens);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_44pdt_reverse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens) {
  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("pdt_reverse", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_pdt_reverse(__pyx_v_fst, __pyx_v_parens, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1704
 * 
 * 
 * cpdef pdt_shortestpath(fst,             # <<<<<<<<<<<<<<
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 */

static PyObject *__pyx_pw_7_pynini_47pdt_shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7_pynini_pdt_shortestpath(PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_pdt_shortestpath *__pyx_optional_args) {
  PyObject *__pyx_v_queue_type = ((PyObject *)__pyx_n_u_fifo);

  /* "_pynini.pyx":1707
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 *                        bool keep_parentheses=False,             # <<<<<<<<<<<<<<
 *                        bool path_gc=True):
 *   """
 */
  bool __pyx_v_keep_parentheses = ((bool)0);

  /* "_pynini.pyx":1708
 *                        queue_type="fifo",
 *                        bool keep_parentheses=False,
 *                        bool path_gc=True):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_shortestpath(fst, parens, queue_type="fifo", keep_parentheses=False,
 */
  bool __pyx_v_path_gc = ((bool)1);
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  std::unique_ptr<fst::script::PdtShortestPathOptions>  __pyx_v__opts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  std::string __pyx_t_3;
  enum fst::QueueType __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pdt_shortestpath", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_queue_type = __pyx_optional_args->queue_type;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_keep_parentheses = __pyx_optional_args->keep_parentheses;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_path_gc = __pyx_optional_args->path_gc;
        }
      }
    }
  }

  /* "_pynini.pyx":1733
 *     FstOpError: Operation failed.
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef unique_ptr[PdtShortestPathOptions] _opts
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1734
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())             # <<<<<<<<<<<<<<
 *   cdef unique_ptr[PdtShortestPathOptions] _opts
 *   _opts.reset(
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1734, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1737
 *   cdef unique_ptr[PdtShortestPathOptions] _opts
 *   _opts.reset(
 *       new PdtShortestPathOptions(_get_queue_type(tostring(queue_type)),             # <<<<<<<<<<<<<<
 *                                  keep_parentheses,
 *                                  path_gc))
 */
  __pyx_t_3 = __pyx_f_10_pywrapfst_tostring(__pyx_v_queue_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L1_error)
  __pyx_t_4 = __pyx_f_10_pywrapfst__get_queue_type(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L1_error)

  /* "_pynini.pyx":1736
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef unique_ptr[PdtShortestPathOptions] _opts
 *   _opts.reset(             # <<<<<<<<<<<<<<
 *       new PdtShortestPathOptions(_get_queue_type(tostring(queue_type)),
 *                                  keep_parentheses,
 */
  __pyx_v__opts.reset(new fst::script::PdtShortestPathOptions(__pyx_t_4, __pyx_v_keep_parentheses, __pyx_v_path_gc));

  /* "_pynini.pyx":1740
 *                                  keep_parentheses,
 *                                  path_gc))
 *   ShortestPath(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *                parens._parens,
 *                result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1740, __pyx_L1_error)
  }

  /* "_pynini.pyx":1741
 *                                  path_gc))
 *   ShortestPath(deref(_fst._fst),
 *                parens._parens,             # <<<<<<<<<<<<<<
 *                result._mfst.get(),
 *                deref(_opts))
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1741, __pyx_L1_error)
  }

  /* "_pynini.pyx":1740
 *                                  keep_parentheses,
 *                                  path_gc))
 *   ShortestPath(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *                parens._parens,
 *                result._mfst.get(),
 */
  fst::script::ShortestPath((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts));

  /* "_pynini.pyx":1744
 *                result._mfst.get(),
 *                deref(_opts))
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1744, __pyx_L1_error)

  /* "_pynini.pyx":1745
 *                deref(_opts))
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":1704
 * 
 * 
 * cpdef pdt_shortestpath(fst,             # <<<<<<<<<<<<<<
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.pdt_shortestpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_47pdt_shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_46pdt_shortestpath[] = "\n  pdt_shortestpath(fst, parens, queue_type=\"fifo\", keep_parentheses=False,\n                   path_gc=True)\n\n  Computes the shortest path through a bounded-stack PDT.\n\n  This operation computes the shortest path through a PDT. The input PDT is\n  defined by the combination of an FST and a PdtParentheses object specifying\n  the PDT stack symbols.\n\n  Args:\n    fst: The FST component of an input PDT.\n    parens: A PdtParentheses object specifying the input PDT's stack symbols.\n    queue_type: A string matching a known queue type; one of: \"fifo\" (default),\n        \"lifo\", \"state\".\n    keep_parentheses: Should the output FST preserve parentheses arcs?\n    path_gc: Should shortest path data be garbage-collected?\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_47pdt_shortestpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens = 0;
  PyObject *__pyx_v_queue_type = 0;
  bool __pyx_v_keep_parentheses;
  bool __pyx_v_path_gc;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pdt_shortestpath (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_parens,&__pyx_n_s_queue_type,&__pyx_n_s_keep_parentheses,&__pyx_n_s_path_gc,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)__pyx_n_u_fifo);
    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_fst)) != 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_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pdt_shortestpath", 0, 2, 5, 1); __PYX_ERR(0, 1704, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_type);
          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_keep_parentheses);
          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_path_gc);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdt_shortestpath") < 0)) __PYX_ERR(0, 1704, __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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fst = values[0];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_PdtParentheses *)values[1]);
    __pyx_v_queue_type = values[2];
    if (values[3]) {
      __pyx_v_keep_parentheses = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_keep_parentheses == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1707, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1707
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 *                        bool keep_parentheses=False,             # <<<<<<<<<<<<<<
 *                        bool path_gc=True):
 *   """
 */
      __pyx_v_keep_parentheses = ((bool)0);
    }
    if (values[4]) {
      __pyx_v_path_gc = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_path_gc == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1708, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1708
 *                        queue_type="fifo",
 *                        bool keep_parentheses=False,
 *                        bool path_gc=True):             # <<<<<<<<<<<<<<
 *   """
 *   pdt_shortestpath(fst, parens, queue_type="fifo", keep_parentheses=False,
 */
      __pyx_v_path_gc = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pdt_shortestpath", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1704, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.pdt_shortestpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_PdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1705, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_46pdt_shortestpath(__pyx_self, __pyx_v_fst, __pyx_v_parens, __pyx_v_queue_type, __pyx_v_keep_parentheses, __pyx_v_path_gc);

  /* "_pynini.pyx":1704
 * 
 * 
 * cpdef pdt_shortestpath(fst,             # <<<<<<<<<<<<<<
 *                        PdtParentheses parens,
 *                        queue_type="fifo",
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_46pdt_shortestpath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v_parens, PyObject *__pyx_v_queue_type, bool __pyx_v_keep_parentheses, bool __pyx_v_path_gc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_pdt_shortestpath __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pdt_shortestpath", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.queue_type = __pyx_v_queue_type;
  __pyx_t_2.keep_parentheses = __pyx_v_keep_parentheses;
  __pyx_t_2.path_gc = __pyx_v_path_gc;
  __pyx_t_1 = __pyx_f_7_pynini_pdt_shortestpath(__pyx_v_fst, __pyx_v_parens, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1771
 *   cdef vector[int64_t] _assign
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses___repr__(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses___repr__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 0);

  /* "_pynini.pyx":1772
 * 
 *   def __repr__(self):
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"             # <<<<<<<<<<<<<<
 * 
 *   def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__16);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__16);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__16);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_at_0x);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__3);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1771
 *   cdef vector[int64_t] _assign
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.MPdtParentheses.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1774
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __len__(self):             # <<<<<<<<<<<<<<
 *     return self._parens.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7_pynini_15MPdtParentheses_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_7_pynini_15MPdtParentheses_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_2__len__(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_7_pynini_15MPdtParentheses_2__len__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "_pynini.pyx":1775
 * 
 *   def __len__(self):
 *     return self._parens.size()             # <<<<<<<<<<<<<<
 * 
 *   def __iter__(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1775, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_parens.size();
  goto __pyx_L0;

  /* "_pynini.pyx":1774
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __len__(self):             # <<<<<<<<<<<<<<
 *     return self._parens.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini.MPdtParentheses.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_15MPdtParentheses_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":1777
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_4__iter__(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_4__iter__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)__pyx_tp_new_7_pynini___pyx_scope_struct_8___iter__(__pyx_ptype_7_pynini___pyx_scope_struct_8___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1777, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_15MPdtParentheses_6generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_MPdtParentheses___iter, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 1777, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

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

static PyObject *__pyx_gb_7_pynini_15MPdtParentheses_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_1;
  std::vector<std::pair<int64_t,int64_t> > ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1777, __pyx_L1_error)

  /* "_pynini.pyx":1778
 * 
 *   def __iter__(self):
 *     cdef size_t _i = 0             # <<<<<<<<<<<<<<
 *     for _i in range(self._parens.size()):
 *       yield (self._parens[_i].first, self._parens[_i].second, self._assign[_i])
 */
  __pyx_cur_scope->__pyx_v__i = 0;

  /* "_pynini.pyx":1779
 *   def __iter__(self):
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):             # <<<<<<<<<<<<<<
 *       yield (self._parens[_i].first, self._parens[_i].second, self._assign[_i])
 * 
 */
  if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1779, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_parens.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v__i = __pyx_t_3;

    /* "_pynini.pyx":1780
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 *       yield (self._parens[_i].first, self._parens[_i].second, self._assign[_i])             # <<<<<<<<<<<<<<
 * 
 *   cpdef MPdtParentheses copy(self):
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
      __PYX_ERR(0, 1780, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyInt_From_int64_t((__pyx_cur_scope->__pyx_v_self->_parens[__pyx_cur_scope->__pyx_v__i]).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
      __PYX_ERR(0, 1780, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyInt_From_int64_t((__pyx_cur_scope->__pyx_v_self->_parens[__pyx_cur_scope->__pyx_v__i]).second); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
      __PYX_ERR(0, 1780, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyInt_From_int64_t((__pyx_cur_scope->__pyx_v_self->_assign[__pyx_cur_scope->__pyx_v__i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1780, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":1777
 *     return self._parens.size()
 * 
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     cdef size_t _i = 0
 *     for _i in range(self._parens.size()):
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1782
 *       yield (self._parens[_i].first, self._parens[_i].second, self._assign[_i])
 * 
 *   cpdef MPdtParentheses copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_f_7_pynini_15MPdtParentheses_copy(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_result = 0;
  struct __pyx_obj_7_pynini_MPdtParentheses *__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;
  std::vector<std::pair<int64_t,int64_t> >  __pyx_t_5;
  std::vector<int64_t>  __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_15MPdtParentheses_8copy)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_MPdtParentheses))))) __PYX_ERR(0, 1782, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1791
 *       A deep copy of the MPdtParentheses object.
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)             # <<<<<<<<<<<<<<
 *     result._parens = self._parens
 *     result._assign = self._assign
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_MPdtParentheses(((PyTypeObject *)__pyx_ptype_7_pynini_MPdtParentheses), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1791, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1792
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     result._parens = self._parens             # <<<<<<<<<<<<<<
 *     result._assign = self._assign
 *     return result
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1792, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_v_self->_parens;
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1792, __pyx_L1_error)
  }
  __pyx_v_result->_parens = __pyx_t_5;

  /* "_pynini.pyx":1793
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     result._parens = self._parens
 *     result._assign = self._assign             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1793, __pyx_L1_error)
  }
  __pyx_t_6 = __pyx_v_self->_assign;
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1793, __pyx_L1_error)
  }
  __pyx_v_result->_assign = __pyx_t_6;

  /* "_pynini.pyx":1794
 *     result._parens = self._parens
 *     result._assign = self._assign
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   cpdef void add_triple(self, int64_t push, int64_t pop, int64_t assignment):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1782
 *       yield (self._parens[_i].first, self._parens[_i].second, self._assign[_i])
 * 
 *   cpdef MPdtParentheses copy(self):             # <<<<<<<<<<<<<<
 *     """
 *     copy(self)
 */

  /* 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("_pynini.MPdtParentheses.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_15MPdtParentheses_7copy[] = "\n    copy(self)\n\n    Makes a copy of this MPdtParentheses object.\n\n    Returns:\n      A deep copy of the MPdtParentheses object.\n    ";
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_8copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_7copy(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_7copy(struct __pyx_obj_7_pynini_MPdtParentheses *__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("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_15MPdtParentheses_copy(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1796
 *     return result
 * 
 *   cpdef void add_triple(self, int64_t push, int64_t pop, int64_t assignment):             # <<<<<<<<<<<<<<
 *     """
 *     add_triple(self, push, pop, assignment)
 */

static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_10add_triple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static void __pyx_f_7_pynini_15MPdtParentheses_add_triple(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int64_t __pyx_v_assignment, int __pyx_skip_dispatch) {
  __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;
  std::pair<int64_t,int64_t>  __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_triple", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_triple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_15MPdtParentheses_10add_triple)) {
        __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_push); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyInt_From_int64_t(__pyx_v_assignment); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL;
        __pyx_t_8 = 0;
        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_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __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_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __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_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1796, __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_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_5 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1809
 *           assigned to.
 *     """
 *     self._parens.push_back(pair[int64_t, int64_t](push, pop))             # <<<<<<<<<<<<<<
 *     self._assign.push_back(assignment)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1809, __pyx_L1_error)
  }
  try {
    __pyx_t_10 = std::pair<int64_t,int64_t> (__pyx_v_push, __pyx_v_pop);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1809, __pyx_L1_error)
  }
  try {
    __pyx_v_self->_parens.push_back(__pyx_t_10);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1809, __pyx_L1_error)
  }

  /* "_pynini.pyx":1810
 *     """
 *     self._parens.push_back(pair[int64_t, int64_t](push, pop))
 *     self._assign.push_back(assignment)             # <<<<<<<<<<<<<<
 * 
 *   @classmethod
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1810, __pyx_L1_error)
  }
  try {
    __pyx_v_self->_assign.push_back(__pyx_v_assignment);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1810, __pyx_L1_error)
  }

  /* "_pynini.pyx":1796
 *     return result
 * 
 *   cpdef void add_triple(self, int64_t push, int64_t pop, int64_t assignment):             # <<<<<<<<<<<<<<
 *     """
 *     add_triple(self, push, pop, assignment)
 */

  /* function exit 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);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_WriteUnraisable("_pynini.MPdtParentheses.add_triple", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_10add_triple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_15MPdtParentheses_9add_triple[] = "\n    add_triple(self, push, pop, assignment)\n\n    Adds a triple of (left parenthesis, right parenthesis, stack assignment)\n    triples to the object.\n\n    Args:\n      push: An arc label to be interpreted as a \"push\" operation.\n      pop: An arc label to be interpreted as a \"pop\" operation.\n      assignment: An arc label indicating what stack the parentheses pair is\n          assigned to.\n    ";
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_10add_triple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int64_t __pyx_v_push;
  int64_t __pyx_v_pop;
  int64_t __pyx_v_assignment;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_triple (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_push,&__pyx_n_s_pop,&__pyx_n_s_assignment,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_push)) != 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_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_triple", 1, 3, 3, 1); __PYX_ERR(0, 1796, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assignment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_triple", 1, 3, 3, 2); __PYX_ERR(0, 1796, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_triple") < 0)) __PYX_ERR(0, 1796, __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_push = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_push == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    __pyx_v_pop = __Pyx_PyInt_As_int64_t(values[1]); if (unlikely((__pyx_v_pop == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    __pyx_v_assignment = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_assignment == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_triple", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1796, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.MPdtParentheses.add_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_9add_triple(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self), __pyx_v_push, __pyx_v_pop, __pyx_v_assignment);

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_9add_triple(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, int64_t __pyx_v_push, int64_t __pyx_v_pop, int64_t __pyx_v_assignment) {
  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("add_triple", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_15MPdtParentheses_add_triple(__pyx_v_self, __pyx_v_push, __pyx_v_pop, __pyx_v_assignment, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1813
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     MPdtParentheses.read(filename)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_12read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_7_pynini_15MPdtParentheses_11read[] = "\n    MPdtParentheses.read(filename)\n\n    Reads parentheses/assignment triples from a text file.\n\n    This class method creates a new MPdtParentheses object from a pairs of\n    integer labels in a text file.\n\n    Args:\n      filename: The string location of the input file.\n\n    Returns:\n      A new MPdtParentheses instance.\n\n    Raises:\n      FstIOError: Read failed.\n    ";
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_12read(PyObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_11read(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_11read(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_filename) {
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::string __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "_pynini.pyx":1831
 *       FstIOError: Read failed.
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)             # <<<<<<<<<<<<<<
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),
 *                                    addr(result._parens),
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7_pynini_MPdtParentheses(((PyTypeObject *)__pyx_ptype_7_pynini_MPdtParentheses), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1831, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1832
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                    addr(result._parens),
 *                                    addr(result._assign),
 */
  __pyx_t_2 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L1_error)

  /* "_pynini.pyx":1833
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),
 *                                    addr(result._parens),             # <<<<<<<<<<<<<<
 *                                    addr(result._assign),
 *                                    False):
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1833, __pyx_L1_error)
  }

  /* "_pynini.pyx":1834
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),
 *                                    addr(result._parens),
 *                                    addr(result._assign),             # <<<<<<<<<<<<<<
 *                                    False):
 *       raise FstIOError(f"Read failed: {filename}")
 */
  if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1834, __pyx_L1_error)
  }

  /* "_pynini.pyx":1832
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                    addr(result._parens),
 *                                    addr(result._assign),
 */
  __pyx_t_3 = ((!(fst::ReadLabelTriples<int64_t>(__pyx_t_2, (&__pyx_v_result->_parens), ((std::vector<int64_t>  *)(&__pyx_v_result->_assign)), 0) != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "_pynini.pyx":1836
 *                                    addr(result._assign),
 *                                    False):
 *       raise FstIOError(f"Read failed: {filename}")             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Read_failed_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1836, __pyx_L1_error)

    /* "_pynini.pyx":1832
 *     """
 *     cdef MPdtParentheses result = MPdtParentheses.__new__(MPdtParentheses)
 *     if not ReadLabelTriples[int64_t](path_tostring(filename),             # <<<<<<<<<<<<<<
 *                                    addr(result._parens),
 *                                    addr(result._assign),
 */
  }

  /* "_pynini.pyx":1837
 *                                    False):
 *       raise FstIOError(f"Read failed: {filename}")
 *     return result             # <<<<<<<<<<<<<<
 * 
 *   cpdef void write(self, filename) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":1813
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     MPdtParentheses.read(filename)
 */

  /* 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_AddTraceback("_pynini.MPdtParentheses.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":1839
 *     return result
 * 
 *   cpdef void write(self, filename) except *:             # <<<<<<<<<<<<<<
 *     """
 *     write(self, filename)
 */

static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static void __pyx_f_7_pynini_15MPdtParentheses_write(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1839, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_15MPdtParentheses_14write)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1839, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":1853
 *       FstIOError: Write failed.
 *     """
 *     if not WriteLabelTriples[int64_t](path_tostring(filename), self._parens,             # <<<<<<<<<<<<<<
 *                                     self._assign):
 *       raise FstIOError(f"Write failed: {filename}")
 */
  __pyx_t_5 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1853, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1853, __pyx_L1_error)
  }

  /* "_pynini.pyx":1854
 *     """
 *     if not WriteLabelTriples[int64_t](path_tostring(filename), self._parens,
 *                                     self._assign):             # <<<<<<<<<<<<<<
 *       raise FstIOError(f"Write failed: {filename}")
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1854, __pyx_L1_error)
  }

  /* "_pynini.pyx":1853
 *       FstIOError: Write failed.
 *     """
 *     if not WriteLabelTriples[int64_t](path_tostring(filename), self._parens,             # <<<<<<<<<<<<<<
 *                                     self._assign):
 *       raise FstIOError(f"Write failed: {filename}")
 */
  __pyx_t_6 = ((!(fst::WriteLabelTriples<int64_t>(__pyx_t_5, __pyx_v_self->_parens, ((std::vector<int64_t>  &)__pyx_v_self->_assign)) != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "_pynini.pyx":1855
 *     if not WriteLabelTriples[int64_t](path_tostring(filename), self._parens,
 *                                     self._assign):
 *       raise FstIOError(f"Write failed: {filename}")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Write_failed, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1855, __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, 1855, __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, 1855, __pyx_L1_error)

    /* "_pynini.pyx":1853
 *       FstIOError: Write failed.
 *     """
 *     if not WriteLabelTriples[int64_t](path_tostring(filename), self._parens,             # <<<<<<<<<<<<<<
 *                                     self._assign):
 *       raise FstIOError(f"Write failed: {filename}")
 */
  }

  /* "_pynini.pyx":1839
 *     return result
 * 
 *   cpdef void write(self, filename) except *:             # <<<<<<<<<<<<<<
 *     """
 *     write(self, filename)
 */

  /* function exit 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_AddTraceback("_pynini.MPdtParentheses.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_7_pynini_15MPdtParentheses_13write[] = "\n    write(self, filename)\n\n    Writes parentheses triples to a text file.\n\n    This method writes the MPdtParentheses object to a text file.\n\n    Args:\n      filename: The string location of the output file.\n\n    Raises:\n      FstIOError: Write failed.\n    ";
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_14write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_13write(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_13write(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v_filename) {
  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("write", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_f_7_pynini_15MPdtParentheses_write(__pyx_v_self, __pyx_v_filename, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1839, __pyx_L1_error)
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

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

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_16__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_16__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_15__reduce_cython__(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self));

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

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

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._assign, self._parens)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_vector_to_py_int64_t(__pyx_v_self->_assign); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(__pyx_v_self->_parens); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __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_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._assign, self._parens)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self._assign, self._parens)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

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

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

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

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, None), state
 *     else:
 */
  __pyx_t_5 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_MPdtParentheses); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_127029315);
    __Pyx_GIVEREF(__pyx_int_127029315);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_127029315);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __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_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, None), state
 *     else:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MPdtParentheses__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_MPdtParentheses); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_127029315);
    __Pyx_GIVEREF(__pyx_int_127029315);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_127029315);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini.MPdtParentheses.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MPdtParentheses__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_18__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_15MPdtParentheses_18__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_15MPdtParentheses_17__setstate_cython__(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7_pynini_15MPdtParentheses_17__setstate_cython__(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MPdtParentheses__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7_pynini___pyx_unpickle_MPdtParentheses__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MPdtParentheses, (type(self), 0x7925043, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MPdtParentheses__set_state(self, __pyx_state)
 */

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

/* "_pynini.pyx":1858
 * 
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,             # <<<<<<<<<<<<<<
 *                        compose_filter="paren", bool left_mpdt=True):
 *   """
 */

static PyObject *__pyx_pw_7_pynini_49mpdt_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_mpdt_compose(PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_mpdt_compose *__pyx_optional_args) {
  PyObject *__pyx_v_compose_filter = ((PyObject *)__pyx_n_u_paren);

  /* "_pynini.pyx":1859
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,
 *                        compose_filter="paren", bool left_mpdt=True):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_compose(fst1, fst2, parens, compose_filter="paren", left_mpdt=True)
 */
  bool __pyx_v_left_mpdt = ((bool)1);
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst1 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst2 = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  std::unique_ptr<fst::MPdtComposeOptions>  __pyx_v__opts;
  struct __pyx_obj_7_pynini_Fst *__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 *);
  std::string __pyx_t_6;
  fst::PdtComposeFilter __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mpdt_compose", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_compose_filter = __pyx_optional_args->compose_filter;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_left_mpdt = __pyx_optional_args->left_mpdt;
      }
    }
  }

  /* "_pynini.pyx":1891
 *   cdef Fst _fst1
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)             # <<<<<<<<<<<<<<
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *   cdef Fst result = Fst(_fst1.arc_type())
 */
  __pyx_t_1 = __pyx_f_7_pynini__compile_or_copy_two_Fsts(__pyx_v_fst1, __pyx_v_fst2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1891, __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, 1891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1891, __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, 1891, __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, 1891, __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, 1891, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1891, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 1891, __pyx_L1_error)
  __pyx_v__fst1 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v__fst2 = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1892
 *   cdef Fst _fst2
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   cdef unique_ptr[MPdtComposeOptions] _opts
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1892, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mfst");
    __PYX_ERR(0, 1892, __pyx_L1_error)
  }
  __pyx_f_7_pynini__maybe_arcsort(__pyx_v__fst1->__pyx_base.__pyx_base._mfst.get(), __pyx_v__fst2->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":1893
 *   (_fst1, _fst2) = _compile_or_copy_two_Fsts(fst1, fst2)
 *   _maybe_arcsort(_fst1._mfst.get(), _fst2._mfst.get())
 *   cdef Fst result = Fst(_fst1.arc_type())             # <<<<<<<<<<<<<<
 *   cdef unique_ptr[MPdtComposeOptions] _opts
 *   _opts.reset(
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1893, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst1), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":1897
 *   _opts.reset(
 *       new MPdtComposeOptions(True,
 *                              _get_pdt_compose_filter(tostring(compose_filter))))             # <<<<<<<<<<<<<<
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),
 */
  __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_compose_filter); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1897, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_7_pynini__get_pdt_compose_filter(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1897, __pyx_L1_error)

  /* "_pynini.pyx":1895
 *   cdef Fst result = Fst(_fst1.arc_type())
 *   cdef unique_ptr[MPdtComposeOptions] _opts
 *   _opts.reset(             # <<<<<<<<<<<<<<
 *       new MPdtComposeOptions(True,
 *                              _get_pdt_compose_filter(tostring(compose_filter))))
 */
  __pyx_v__opts.reset(new fst::MPdtComposeOptions(1, __pyx_t_7));

  /* "_pynini.pyx":1898
 *       new MPdtComposeOptions(True,
 *                              _get_pdt_compose_filter(tostring(compose_filter))))
 *   Compose(deref(_fst1._fst),             # <<<<<<<<<<<<<<
 *           deref(_fst2._fst),
 *           parens._parens,
 */
  if (unlikely(((PyObject *)__pyx_v__fst1) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1898, __pyx_L1_error)
  }

  /* "_pynini.pyx":1899
 *                              _get_pdt_compose_filter(tostring(compose_filter))))
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),             # <<<<<<<<<<<<<<
 *           parens._parens,
 *           parens._assign,
 */
  if (unlikely(((PyObject *)__pyx_v__fst2) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1899, __pyx_L1_error)
  }

  /* "_pynini.pyx":1900
 *   Compose(deref(_fst1._fst),
 *           deref(_fst2._fst),
 *           parens._parens,             # <<<<<<<<<<<<<<
 *           parens._assign,
 *           result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1900, __pyx_L1_error)
  }

  /* "_pynini.pyx":1901
 *           deref(_fst2._fst),
 *           parens._parens,
 *           parens._assign,             # <<<<<<<<<<<<<<
 *           result._mfst.get(),
 *           deref(_opts),
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1901, __pyx_L1_error)
  }

  /* "_pynini.pyx":1898
 *       new MPdtComposeOptions(True,
 *                              _get_pdt_compose_filter(tostring(compose_filter))))
 *   Compose(deref(_fst1._fst),             # <<<<<<<<<<<<<<
 *           deref(_fst2._fst),
 *           parens._parens,
 */
  fst::script::Compose((*__pyx_v__fst1->__pyx_base.__pyx_base.__pyx_base._fst), (*__pyx_v__fst2->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_parens->_assign, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts), __pyx_v_left_mpdt);

  /* "_pynini.pyx":1905
 *           deref(_opts),
 *           left_mpdt)
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1858
 * 
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,             # <<<<<<<<<<<<<<
 *                        compose_filter="paren", bool left_mpdt=True):
 *   """
 */

  /* 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("_pynini.mpdt_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst1);
  __Pyx_XDECREF((PyObject *)__pyx_v__fst2);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_49mpdt_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_48mpdt_compose[] = "\n  mpdt_compose(fst1, fst2, parens, compose_filter=\"paren\", left_mpdt=True)\n\n  Composes a MPDT with an FST.\n\n  This operation composes a MPDT with an FST. The input MPDT is defined by the\n  combination of an FST and a MPdtParentheses object specifying the stack\n  symbols and assignments. The caller should also specify whether the left-hand\n  or the right-hand FST argument is to be interpreted as a MPDT.\n\n  Args:\n    fst1: The left-hand-side input FST or MPDT.\n    fst2: The right-hand-side input FST or MPDT.\n    parens: A MPdtParentheses object specifying the input MPDT's stack\n        operations and assignments.\n    compose_filter: A string indicating the desired MPDT composition filter; one\n        of: \"paren\" (keeps parentheses), \"expand\" (expands and removes\n        parentheses), \"expand_paren\" (expands and keeps parentheses).\n    left_mpdt: If true, the first argument is interpreted as a MPDT and the\n        second argument is interpreted as an FST; if false, the second\n        argument is interpreted as a MPDT and the first argument is interpreted\n        as an FST.\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_49mpdt_compose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst1 = 0;
  PyObject *__pyx_v_fst2 = 0;
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens = 0;
  PyObject *__pyx_v_compose_filter = 0;
  bool __pyx_v_left_mpdt;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mpdt_compose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst1,&__pyx_n_s_fst2,&__pyx_n_s_parens,&__pyx_n_s_compose_filter,&__pyx_n_s_left_mpdt,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_u_paren);
    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_fst1)) != 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_fst2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mpdt_compose", 0, 3, 5, 1); __PYX_ERR(0, 1858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mpdt_compose", 0, 3, 5, 2); __PYX_ERR(0, 1858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compose_filter);
          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_left_mpdt);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mpdt_compose") < 0)) __PYX_ERR(0, 1858, __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);
        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_fst1 = values[0];
    __pyx_v_fst2 = values[1];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_MPdtParentheses *)values[2]);
    __pyx_v_compose_filter = values[3];
    if (values[4]) {
      __pyx_v_left_mpdt = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_left_mpdt == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1859
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,
 *                        compose_filter="paren", bool left_mpdt=True):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_compose(fst1, fst2, parens, compose_filter="paren", left_mpdt=True)
 */
      __pyx_v_left_mpdt = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mpdt_compose", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1858, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.mpdt_compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_MPdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1858, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_48mpdt_compose(__pyx_self, __pyx_v_fst1, __pyx_v_fst2, __pyx_v_parens, __pyx_v_compose_filter, __pyx_v_left_mpdt);

  /* "_pynini.pyx":1858
 * 
 * 
 * cpdef Fst mpdt_compose(fst1, fst2, MPdtParentheses parens,             # <<<<<<<<<<<<<<
 *                        compose_filter="paren", bool left_mpdt=True):
 *   """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_48mpdt_compose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst1, PyObject *__pyx_v_fst2, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, PyObject *__pyx_v_compose_filter, bool __pyx_v_left_mpdt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_mpdt_compose __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mpdt_compose", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.compose_filter = __pyx_v_compose_filter;
  __pyx_t_2.left_mpdt = __pyx_v_left_mpdt;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_mpdt_compose(__pyx_v_fst1, __pyx_v_fst2, __pyx_v_parens, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1908
 * 
 * 
 * cpdef Fst mpdt_expand(fst,             # <<<<<<<<<<<<<<
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 */

static PyObject *__pyx_pw_7_pynini_51mpdt_expand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_mpdt_expand(PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_mpdt_expand *__pyx_optional_args) {

  /* "_pynini.pyx":1910
 * cpdef Fst mpdt_expand(fst,
 *                       MPdtParentheses parens,
 *                       bool connect=True,             # <<<<<<<<<<<<<<
 *                       bool keep_parentheses=False):
 *   """
 */
  bool __pyx_v_connect = ((bool)1);

  /* "_pynini.pyx":1911
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 *                       bool keep_parentheses=False):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_expand(fst, parens, connect=True, keep_parentheses=False):
 */
  bool __pyx_v_keep_parentheses = ((bool)0);
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  std::unique_ptr<fst::MPdtExpandOptions>  __pyx_v__opts;
  struct __pyx_obj_7_pynini_Fst *__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("mpdt_expand", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_connect = __pyx_optional_args->connect;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_keep_parentheses = __pyx_optional_args->keep_parentheses;
      }
    }
  }

  /* "_pynini.pyx":1937
 *     FstOpError: Operation failed.
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef unique_ptr[MPdtExpandOptions] _opts
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1938
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result = Fst(_fst.arc_type())             # <<<<<<<<<<<<<<
 *   cdef unique_ptr[MPdtExpandOptions] _opts
 *   _opts.reset(new MPdtExpandOptions(connect, keep_parentheses))
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1938, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1940
 *   cdef Fst result = Fst(_fst.arc_type())
 *   cdef unique_ptr[MPdtExpandOptions] _opts
 *   _opts.reset(new MPdtExpandOptions(connect, keep_parentheses))             # <<<<<<<<<<<<<<
 *   Expand(deref(_fst._fst),
 *          parens._parens,
 */
  __pyx_v__opts.reset(new fst::MPdtExpandOptions(__pyx_v_connect, __pyx_v_keep_parentheses));

  /* "_pynini.pyx":1941
 *   cdef unique_ptr[MPdtExpandOptions] _opts
 *   _opts.reset(new MPdtExpandOptions(connect, keep_parentheses))
 *   Expand(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *          parens._parens,
 *          parens._assign,
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1941, __pyx_L1_error)
  }

  /* "_pynini.pyx":1942
 *   _opts.reset(new MPdtExpandOptions(connect, keep_parentheses))
 *   Expand(deref(_fst._fst),
 *          parens._parens,             # <<<<<<<<<<<<<<
 *          parens._assign,
 *          result._mfst.get(),
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1942, __pyx_L1_error)
  }

  /* "_pynini.pyx":1943
 *   Expand(deref(_fst._fst),
 *          parens._parens,
 *          parens._assign,             # <<<<<<<<<<<<<<
 *          result._mfst.get(),
 *          deref(_opts))
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1943, __pyx_L1_error)
  }

  /* "_pynini.pyx":1941
 *   cdef unique_ptr[MPdtExpandOptions] _opts
 *   _opts.reset(new MPdtExpandOptions(connect, keep_parentheses))
 *   Expand(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *          parens._parens,
 *          parens._assign,
 */
  fst::script::Expand((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_parens->_parens, __pyx_v_parens->_assign, __pyx_v_result->__pyx_base.__pyx_base._mfst.get(), (*__pyx_v__opts));

  /* "_pynini.pyx":1946
 *          result._mfst.get(),
 *          deref(_opts))
 *   result._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return result
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1946, __pyx_L1_error)

  /* "_pynini.pyx":1947
 *          deref(_opts))
 *   result._check_mutating_imethod()
 *   return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "_pynini.pyx":1908
 * 
 * 
 * cpdef Fst mpdt_expand(fst,             # <<<<<<<<<<<<<<
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.mpdt_expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_51mpdt_expand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_50mpdt_expand[] = "\n  mpdt_expand(fst, parens, connect=True, keep_parentheses=False):\n\n  Expands a bounded-stack MPDT to an FST.\n\n  This operation converts a bounded-stack MPDT into the equivalent FST. The\n  input MPDT is defined by the combination of an FST and a MPdtParentheses\n  object specifying the MPDT stack symbols and assignments.\n\n  If the input MPDT does not have a bounded stack, then it is impossible to\n  expand the MPDT into an FST and this operation will not terminate.\n\n  Args:\n    fst: The FST component of the input MPDT.\n    parens: A MPdtParentheses object specifying the input PDT's stack\n        symbols and assignments.\n    connect: Should the output FST be trimmed?\n    keep_parentheses: Should the output FST preserve parentheses arcs?\n\n  Returns:\n    An FST.\n\n  Raises:\n    FstOpError: Operation failed.\n  ";
static PyObject *__pyx_pw_7_pynini_51mpdt_expand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens = 0;
  bool __pyx_v_connect;
  bool __pyx_v_keep_parentheses;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mpdt_expand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_parens,&__pyx_n_s_connect,&__pyx_n_s_keep_parentheses,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_fst)) != 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_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mpdt_expand", 0, 2, 4, 1); __PYX_ERR(0, 1908, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connect);
          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_keep_parentheses);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mpdt_expand") < 0)) __PYX_ERR(0, 1908, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fst = values[0];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_MPdtParentheses *)values[1]);
    if (values[2]) {
      __pyx_v_connect = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_connect == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1910, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1910
 * cpdef Fst mpdt_expand(fst,
 *                       MPdtParentheses parens,
 *                       bool connect=True,             # <<<<<<<<<<<<<<
 *                       bool keep_parentheses=False):
 *   """
 */
      __pyx_v_connect = ((bool)1);
    }
    if (values[3]) {
      __pyx_v_keep_parentheses = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_keep_parentheses == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1911, __pyx_L3_error)
    } else {

      /* "_pynini.pyx":1911
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 *                       bool keep_parentheses=False):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_expand(fst, parens, connect=True, keep_parentheses=False):
 */
      __pyx_v_keep_parentheses = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mpdt_expand", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1908, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.mpdt_expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_MPdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1909, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_50mpdt_expand(__pyx_self, __pyx_v_fst, __pyx_v_parens, __pyx_v_connect, __pyx_v_keep_parentheses);

  /* "_pynini.pyx":1908
 * 
 * 
 * cpdef Fst mpdt_expand(fst,             # <<<<<<<<<<<<<<
 *                       MPdtParentheses parens,
 *                       bool connect=True,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_50mpdt_expand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens, bool __pyx_v_connect, bool __pyx_v_keep_parentheses) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7_pynini_mpdt_expand __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mpdt_expand", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.connect = __pyx_v_connect;
  __pyx_t_2.keep_parentheses = __pyx_v_keep_parentheses;
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_mpdt_expand(__pyx_v_fst, __pyx_v_parens, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":1950
 * 
 * 
 * def mpdt_reverse(fst, MPdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_reverse(fst, parens)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_53mpdt_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_52mpdt_reverse[] = "\n  mpdt_reverse(fst, parens)\n\n  Reverses a MPDT.\n\n  This operation reverses an MPDT. The input MPDT is defined by the combination\n  of an FST and a MPdtParentheses object specifying the MPDT stack symbols\n  and assignments. Unlike PDT reversal, which only modifies the FST component,\n  this operation also reverses the stack assignments. assignments.\n\n  Args:\n    fst: The FST component of the input MPDT.\n    parens: A MPdtParentheses object specifying the input MPDT's stack symbols\n        and assignments.\n\n  Returns:\n    A (Fst, MPdtParentheses) pair.\n  ";
static PyMethodDef __pyx_mdef_7_pynini_53mpdt_reverse = {"mpdt_reverse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_53mpdt_reverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_52mpdt_reverse};
static PyObject *__pyx_pw_7_pynini_53mpdt_reverse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mpdt_reverse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_parens,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_fst)) != 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_parens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mpdt_reverse", 1, 2, 2, 1); __PYX_ERR(0, 1950, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mpdt_reverse") < 0)) __PYX_ERR(0, 1950, __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_fst = values[0];
    __pyx_v_parens = ((struct __pyx_obj_7_pynini_MPdtParentheses *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mpdt_reverse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1950, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.mpdt_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parens), __pyx_ptype_7_pynini_MPdtParentheses, 1, "parens", 0))) __PYX_ERR(0, 1950, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_52mpdt_reverse(__pyx_self, __pyx_v_fst, __pyx_v_parens);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_52mpdt_reverse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fst, struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_parens) {
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result_fst = 0;
  struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v_result_parens = 0;
  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("mpdt_reverse", 0);

  /* "_pynini.pyx":1969
 *     A (Fst, MPdtParentheses) pair.
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *   cdef Fst result_fst = Fst(_fst.arc_type())
 *   cdef MPdtParentheses result_parens = parens.copy()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":1970
 *   """
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result_fst = Fst(_fst.arc_type())             # <<<<<<<<<<<<<<
 *   cdef MPdtParentheses result_parens = parens.copy()
 *   Reverse(deref(_fst._fst),
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
    __PYX_ERR(0, 1970, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.arc_type(((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v__fst), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result_fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1971
 *   cdef Fst _fst = _compile_or_copy_Fst(fst)
 *   cdef Fst result_fst = Fst(_fst.arc_type())
 *   cdef MPdtParentheses result_parens = parens.copy()             # <<<<<<<<<<<<<<
 *   Reverse(deref(_fst._fst),
 *           result_parens._parens,
 */
  if (unlikely(((PyObject *)__pyx_v_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "copy");
    __PYX_ERR(0, 1971, __pyx_L1_error)
  }
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini_MPdtParentheses *)__pyx_v_parens->__pyx_vtab)->copy(__pyx_v_parens, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result_parens = ((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_pynini.pyx":1972
 *   cdef Fst result_fst = Fst(_fst.arc_type())
 *   cdef MPdtParentheses result_parens = parens.copy()
 *   Reverse(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *           result_parens._parens,
 *           addr(result_parens._assign),
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 1972, __pyx_L1_error)
  }

  /* "_pynini.pyx":1973
 *   cdef MPdtParentheses result_parens = parens.copy()
 *   Reverse(deref(_fst._fst),
 *           result_parens._parens,             # <<<<<<<<<<<<<<
 *           addr(result_parens._assign),
 *           result_fst._mfst.get())
 */
  if (unlikely(((PyObject *)__pyx_v_result_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(0, 1973, __pyx_L1_error)
  }

  /* "_pynini.pyx":1974
 *   Reverse(deref(_fst._fst),
 *           result_parens._parens,
 *           addr(result_parens._assign),             # <<<<<<<<<<<<<<
 *           result_fst._mfst.get())
 *   result_fst._check_mutating_imethod()
 */
  if (unlikely(((PyObject *)__pyx_v_result_parens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(0, 1974, __pyx_L1_error)
  }

  /* "_pynini.pyx":1972
 *   cdef Fst result_fst = Fst(_fst.arc_type())
 *   cdef MPdtParentheses result_parens = parens.copy()
 *   Reverse(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *           result_parens._parens,
 *           addr(result_parens._assign),
 */
  fst::script::Reverse((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v_result_parens->_parens, (&__pyx_v_result_parens->_assign), __pyx_v_result_fst->__pyx_base.__pyx_base._mfst.get());

  /* "_pynini.pyx":1976
 *           addr(result_parens._assign),
 *           result_fst._mfst.get())
 *   result_fst._check_mutating_imethod()             # <<<<<<<<<<<<<<
 *   return (result_fst, result_parens)
 * 
 */
  ((struct __pyx_vtabstruct_7_pynini_Fst *)__pyx_v_result_fst->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._check_mutating_imethod(((struct __pyx_obj_10_pywrapfst_MutableFst *)__pyx_v_result_fst)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1976, __pyx_L1_error)

  /* "_pynini.pyx":1977
 *           result_fst._mfst.get())
 *   result_fst._check_mutating_imethod()
 *   return (result_fst, result_parens)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_result_fst));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result_fst));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_result_fst));
  __Pyx_INCREF(((PyObject *)__pyx_v_result_parens));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result_parens));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_result_parens));
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":1950
 * 
 * 
 * def mpdt_reverse(fst, MPdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_reverse(fst, parens)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.mpdt_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_fst);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_parens);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2020
 *   cdef unique_ptr[StringPathIteratorClass] _paths
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator___repr__(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator___repr__(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __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("__repr__", 0);

  /* "_pynini.pyx":2021
 * 
 *   def __repr__(self):
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"             # <<<<<<<<<<<<<<
 * 
 *   def __init__(self, fst, input_token_type=None, output_token_type=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__16);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__16);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__16);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x);
  __pyx_t_2 += 6;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_at_0x);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_4, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__3);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2020
 *   cdef unique_ptr[StringPathIteratorClass] _paths
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini._StringPathIterator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2023
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __init__(self, fst, input_token_type=None, output_token_type=None):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _input_token_type
 *     cdef const_SymbolTable_ptr _isymbols = NULL
 */

/* Python wrapper */
static int __pyx_pw_7_pynini_19_StringPathIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7_pynini_19_StringPathIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fst = 0;
  PyObject *__pyx_v_input_token_type = 0;
  PyObject *__pyx_v_output_token_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fst,&__pyx_n_s_input_token_type,&__pyx_n_s_output_token_type,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_fst)) != 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_input_token_type);
          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_output_token_type);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2023, __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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fst = values[0];
    __pyx_v_input_token_type = values[1];
    __pyx_v_output_token_type = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2023, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini._StringPathIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_2__init__(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self), __pyx_v_fst, __pyx_v_input_token_type, __pyx_v_output_token_type);

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

static int __pyx_pf_7_pynini_19_StringPathIterator_2__init__(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, PyObject *__pyx_v_fst, PyObject *__pyx_v_input_token_type, PyObject *__pyx_v_output_token_type) {
  fst::TokenType __pyx_v__input_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__isymbols;
  fst::TokenType __pyx_v__output_token_type;
  __pyx_t_10_pywrapfst_const_SymbolTable_ptr __pyx_v__osymbols;
  struct __pyx_obj_7_pynini_Fst *__pyx_v__fst = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  fst::SymbolTable const *__pyx_t_5;
  std::string __pyx_t_6;
  fst::TokenType __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "_pynini.pyx":2025
 *   def __init__(self, fst, input_token_type=None, output_token_type=None):
 *     cdef _TokenType _input_token_type
 *     cdef const_SymbolTable_ptr _isymbols = NULL             # <<<<<<<<<<<<<<
 *     if input_token_type is None:
 *       _input_token_type = GetDefaultTokenType()
 */
  __pyx_v__isymbols = NULL;

  /* "_pynini.pyx":2026
 *     cdef _TokenType _input_token_type
 *     cdef const_SymbolTable_ptr _isymbols = NULL
 *     if input_token_type is None:             # <<<<<<<<<<<<<<
 *       _input_token_type = GetDefaultTokenType()
 *       _isymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_input_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":2027
 *     cdef const_SymbolTable_ptr _isymbols = NULL
 *     if input_token_type is None:
 *       _input_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *       _isymbols = GetDefaultSymbols()
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__input_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":2028
 *     if input_token_type is None:
 *       _input_token_type = GetDefaultTokenType()
 *       _isymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *       _input_token_type = _TokenType.SYMBOL
 */
    __pyx_v__isymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":2026
 *     cdef _TokenType _input_token_type
 *     cdef const_SymbolTable_ptr _isymbols = NULL
 *     if input_token_type is None:             # <<<<<<<<<<<<<<
 *       _input_token_type = GetDefaultTokenType()
 *       _isymbols = GetDefaultSymbols()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":2029
 *       _input_token_type = GetDefaultTokenType()
 *       _isymbols = GetDefaultSymbols()
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _input_token_type = _TokenType.SYMBOL
 *       _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_input_token_type, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2029, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":2030
 *       _isymbols = GetDefaultSymbols()
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *       _input_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *       _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *     else:
 */
    __pyx_v__input_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":2031
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):
 *       _input_token_type = _TokenType.SYMBOL
 *       _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *     else:
 *       _input_token_type = _get_token_type(tostring(input_token_type))
 */
    if (unlikely(__pyx_v_input_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 2031, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_input_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2031, __pyx_L1_error)
    __pyx_v__isymbols = __pyx_t_5;

    /* "_pynini.pyx":2029
 *       _input_token_type = GetDefaultTokenType()
 *       _isymbols = GetDefaultSymbols()
 *     elif isinstance(input_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _input_token_type = _TokenType.SYMBOL
 *       _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":2033
 *       _isymbols = (<_SymbolTableView> input_token_type)._raw_ptr_or_raise()
 *     else:
 *       _input_token_type = _get_token_type(tostring(input_token_type))             # <<<<<<<<<<<<<<
 *     cdef _TokenType _output_token_type
 *     cdef const_SymbolTable_ptr _osymbols = NULL
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_input_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_v__input_token_type = __pyx_t_7;
  }
  __pyx_L3:;

  /* "_pynini.pyx":2035
 *       _input_token_type = _get_token_type(tostring(input_token_type))
 *     cdef _TokenType _output_token_type
 *     cdef const_SymbolTable_ptr _osymbols = NULL             # <<<<<<<<<<<<<<
 *     if output_token_type is None:
 *       _output_token_type = GetDefaultTokenType()
 */
  __pyx_v__osymbols = NULL;

  /* "_pynini.pyx":2036
 *     cdef _TokenType _output_token_type
 *     cdef const_SymbolTable_ptr _osymbols = NULL
 *     if output_token_type is None:             # <<<<<<<<<<<<<<
 *       _output_token_type = GetDefaultTokenType()
 *       _osymbols = GetDefaultSymbols()
 */
  __pyx_t_1 = (__pyx_v_output_token_type == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":2037
 *     cdef const_SymbolTable_ptr _osymbols = NULL
 *     if output_token_type is None:
 *       _output_token_type = GetDefaultTokenType()             # <<<<<<<<<<<<<<
 *       _osymbols = GetDefaultSymbols()
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 */
    __pyx_v__output_token_type = fst::GetDefaultTokenType();

    /* "_pynini.pyx":2038
 *     if output_token_type is None:
 *       _output_token_type = GetDefaultTokenType()
 *       _osymbols = GetDefaultSymbols()             # <<<<<<<<<<<<<<
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *       _output_token_type = _TokenType.SYMBOL
 */
    __pyx_v__osymbols = fst::GetDefaultSymbols();

    /* "_pynini.pyx":2036
 *     cdef _TokenType _output_token_type
 *     cdef const_SymbolTable_ptr _osymbols = NULL
 *     if output_token_type is None:             # <<<<<<<<<<<<<<
 *       _output_token_type = GetDefaultTokenType()
 *       _osymbols = GetDefaultSymbols()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":2039
 *       _output_token_type = GetDefaultTokenType()
 *       _osymbols = GetDefaultSymbols()
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _output_token_type = _TokenType.SYMBOL
 *       _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_output_token_type, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "_pynini.pyx":2040
 *       _osymbols = GetDefaultSymbols()
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *       _output_token_type = _TokenType.SYMBOL             # <<<<<<<<<<<<<<
 *       _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *     else:
 */
    __pyx_v__output_token_type = fst::TokenType::SYMBOL;

    /* "_pynini.pyx":2041
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):
 *       _output_token_type = _TokenType.SYMBOL
 *       _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()             # <<<<<<<<<<<<<<
 *     else:
 *       _output_token_type = _get_token_type(tostring(output_token_type))
 */
    if (unlikely(__pyx_v_output_token_type == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_raw_ptr_or_raise");
      __PYX_ERR(0, 2041, __pyx_L1_error)
    }
    __pyx_t_5 = ((struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView *)((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)->__pyx_vtab)->_raw_ptr_or_raise(((struct __pyx_obj_10_pywrapfst_SymbolTableView *)__pyx_v_output_token_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2041, __pyx_L1_error)
    __pyx_v__osymbols = __pyx_t_5;

    /* "_pynini.pyx":2039
 *       _output_token_type = GetDefaultTokenType()
 *       _osymbols = GetDefaultSymbols()
 *     elif isinstance(output_token_type, _pywrapfst.SymbolTableView):             # <<<<<<<<<<<<<<
 *       _output_token_type = _TokenType.SYMBOL
 *       _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 */
    goto __pyx_L4;
  }

  /* "_pynini.pyx":2043
 *       _osymbols = (<_SymbolTableView> output_token_type)._raw_ptr_or_raise()
 *     else:
 *       _output_token_type = _get_token_type(tostring(output_token_type))             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     self._paths.reset(
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10_pywrapfst_tostring(__pyx_v_output_token_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2043, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7_pynini__get_token_type(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2043, __pyx_L1_error)
    __pyx_v__output_token_type = __pyx_t_7;
  }
  __pyx_L4:;

  /* "_pynini.pyx":2044
 *     else:
 *       _output_token_type = _get_token_type(tostring(output_token_type))
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)             # <<<<<<<<<<<<<<
 *     self._paths.reset(
 *         new StringPathIteratorClass(deref(_fst._fst),
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_fst, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__fst = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "_pynini.pyx":2045
 *       _output_token_type = _get_token_type(tostring(output_token_type))
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     self._paths.reset(             # <<<<<<<<<<<<<<
 *         new StringPathIteratorClass(deref(_fst._fst),
 *                                     _input_token_type,
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2045, __pyx_L1_error)
  }

  /* "_pynini.pyx":2046
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     self._paths.reset(
 *         new StringPathIteratorClass(deref(_fst._fst),             # <<<<<<<<<<<<<<
 *                                     _input_token_type,
 *                                     _output_token_type,
 */
  if (unlikely(((PyObject *)__pyx_v__fst) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_fst");
    __PYX_ERR(0, 2046, __pyx_L1_error)
  }

  /* "_pynini.pyx":2045
 *       _output_token_type = _get_token_type(tostring(output_token_type))
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     self._paths.reset(             # <<<<<<<<<<<<<<
 *         new StringPathIteratorClass(deref(_fst._fst),
 *                                     _input_token_type,
 */
  __pyx_v_self->_paths.reset(new fst::script::StringPathIteratorClass((*__pyx_v__fst->__pyx_base.__pyx_base.__pyx_base._fst), __pyx_v__input_token_type, __pyx_v__output_token_type, __pyx_v__isymbols, __pyx_v__osymbols));

  /* "_pynini.pyx":2051
 *                                     _isymbols,
 *                                     _osymbols))
 *     if self._paths.get().Error():             # <<<<<<<<<<<<<<
 *       raise FstOpError("Operation failed")
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2051, __pyx_L1_error)
  }
  __pyx_t_1 = (__pyx_v_self->_paths.get()->Error() != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":2052
 *                                     _osymbols))
 *     if self._paths.get().Error():
 *       raise FstOpError("Operation failed")             # <<<<<<<<<<<<<<
 * 
 *   cpdef bool done(self):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstOpError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    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_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_kp_u_Operation_failed) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Operation_failed);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2052, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 2052, __pyx_L1_error)

    /* "_pynini.pyx":2051
 *                                     _isymbols,
 *                                     _osymbols))
 *     if self._paths.get().Error():             # <<<<<<<<<<<<<<
 *       raise FstOpError("Operation failed")
 * 
 */
  }

  /* "_pynini.pyx":2023
 *     return f"<{self.__class__.__name__} at 0x{id(self):x}>"
 * 
 *   def __init__(self, fst, input_token_type=None, output_token_type=None):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _input_token_type
 *     cdef const_SymbolTable_ptr _isymbols = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_pynini._StringPathIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__fst);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2054
 *       raise FstOpError("Operation failed")
 * 
 *   cpdef bool done(self):             # <<<<<<<<<<<<<<
 *     """
 *     done(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_5done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static bool __pyx_f_7_pynini_19_StringPathIterator_done(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("done", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_5done)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2054, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2054, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2063
 *       True if the iterator is exhausted, False otherwise.
 *     """
 *     return self._paths.get().Done()             # <<<<<<<<<<<<<<
 * 
 *   cpdef bool error(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2063, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_paths.get()->Done();
  goto __pyx_L0;

  /* "_pynini.pyx":2054
 *       raise FstOpError("Operation failed")
 * 
 *   cpdef bool done(self):             # <<<<<<<<<<<<<<
 *     """
 *     done(self)
 */

  /* 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_WriteUnraisable("_pynini._StringPathIterator.done", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_5done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_4done[] = "\n    done(self)\n\n    Indicates whether the iterator is exhausted or not.\n\n    Returns:\n      True if the iterator is exhausted, False otherwise.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_5done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("done (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_4done(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_4done(struct __pyx_obj_7_pynini__StringPathIterator *__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("done", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_7_pynini_19_StringPathIterator_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2065
 *     return self._paths.get().Done()
 * 
 *   cpdef bool error(self):             # <<<<<<<<<<<<<<
 *     """
 *     error(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_7error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static bool __pyx_f_7_pynini_19_StringPathIterator_error(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("error", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_7error)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2065, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2065, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2074
 *       True if the _StringPathIterator is in an errorful state, False otherwise.
 *     """
 *     return self._paths.get().Error()             # <<<<<<<<<<<<<<
 * 
 *   def ilabels(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2074, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_paths.get()->Error();
  goto __pyx_L0;

  /* "_pynini.pyx":2065
 *     return self._paths.get().Done()
 * 
 *   cpdef bool error(self):             # <<<<<<<<<<<<<<
 *     """
 *     error(self)
 */

  /* 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_WriteUnraisable("_pynini._StringPathIterator.error", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_7error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_6error[] = "\n    error(self)\n\n    Indicates whether the _StringPathIterator has encountered an error.\n\n    Returns:\n      True if the _StringPathIterator is in an errorful state, False otherwise.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_7error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("error (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_6error(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_6error(struct __pyx_obj_7_pynini__StringPathIterator *__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("error", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_7_pynini_19_StringPathIterator_error(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2076
 *     return self._paths.get().Error()
 * 
 *   def ilabels(self):             # <<<<<<<<<<<<<<
 *     """
 *     ilabels(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_9ilabels(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_8ilabels[] = "\n    ilabels(self)\n\n    Returns the input labels for the current path.\n\n    Returns:\n      A list of input labels for the current path.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_9ilabels(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ilabels (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_8ilabels(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_8ilabels(struct __pyx_obj_7_pynini__StringPathIterator *__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("ilabels", 0);

  /* "_pynini.pyx":2085
 *       A list of input labels for the current path.
 *     """
 *     return self._paths.get().ILabels()             # <<<<<<<<<<<<<<
 * 
 *   def olabels(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2085, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_vector_to_py_int64_t(__pyx_v_self->_paths.get()->ILabels()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2076
 *     return self._paths.get().Error()
 * 
 *   def ilabels(self):             # <<<<<<<<<<<<<<
 *     """
 *     ilabels(self)
 */

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

/* "_pynini.pyx":2087
 *     return self._paths.get().ILabels()
 * 
 *   def olabels(self):             # <<<<<<<<<<<<<<
 *     """
 *     olabels(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_11olabels(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_10olabels[] = "\n    olabels(self)\n\n    Returns the output labels for the current path.\n\n    Returns:\n      A list of output labels for the current path.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_11olabels(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("olabels (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_10olabels(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_10olabels(struct __pyx_obj_7_pynini__StringPathIterator *__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("olabels", 0);

  /* "_pynini.pyx":2096
 *       A list of output labels for the current path.
 *     """
 *     return self._paths.get().OLabels()             # <<<<<<<<<<<<<<
 * 
 *   cpdef string istring(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2096, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_vector_to_py_int64_t(__pyx_v_self->_paths.get()->OLabels()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2087
 *     return self._paths.get().ILabels()
 * 
 *   def olabels(self):             # <<<<<<<<<<<<<<
 *     """
 *     olabels(self)
 */

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

/* "_pynini.pyx":2098
 *     return self._paths.get().OLabels()
 * 
 *   cpdef string istring(self):             # <<<<<<<<<<<<<<
 *     """
 *     istring(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_13istring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_19_StringPathIterator_istring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("istring", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_istring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_13istring)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2098, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2098, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2107
 *       The path's input string.
 *     """
 *     return self._paths.get().IString()             # <<<<<<<<<<<<<<
 * 
 *   def istrings(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2107, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_paths.get()->IString();
  goto __pyx_L0;

  /* "_pynini.pyx":2098
 *     return self._paths.get().OLabels()
 * 
 *   cpdef string istring(self):             # <<<<<<<<<<<<<<
 *     """
 *     istring(self)
 */

  /* 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_WriteUnraisable("_pynini._StringPathIterator.istring", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_13istring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_12istring[] = "\n    istring(self)\n\n    Returns the current path's input string.\n\n    Returns:\n      The path's input string.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_13istring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("istring (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_12istring(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_12istring(struct __pyx_obj_7_pynini__StringPathIterator *__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("istring", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_7_pynini_19_StringPathIterator_istring(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._StringPathIterator.istring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_16generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":2109
 *     return self._paths.get().IString()
 * 
 *   def istrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     istrings(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_15istrings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_14istrings[] = "\n    istrings(self)\n\n    Generates all input strings in the FST.\n\n    This method returns a generator over all input strings in the path. The\n    caller is responsible for resetting the iterator if desired.\n\n    Yields:\n      All input strings.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_15istrings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("istrings (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_14istrings(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_14istrings(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("istrings", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)__pyx_tp_new_7_pynini___pyx_scope_struct_9_istrings(__pyx_ptype_7_pynini___pyx_scope_struct_9_istrings, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2109, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_19_StringPathIterator_16generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_istrings, __pyx_n_s_StringPathIterator_istrings, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini._StringPathIterator.istrings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_16generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("istrings", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2109, __pyx_L1_error)

  /* "_pynini.pyx":2121
 *       All input strings.
 *     """
 *     while not self._paths.get().Done():             # <<<<<<<<<<<<<<
 *       yield self.istring()
 *       self._paths.get().Next()
 */
  while (1) {
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2121, __pyx_L1_error)
    }
    __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->_paths.get()->Done() != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "_pynini.pyx":2122
 *     """
 *     while not self._paths.get().Done():
 *       yield self.istring()             # <<<<<<<<<<<<<<
 *       self._paths.get().Next()
 * 
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "istring");
      __PYX_ERR(0, 2122, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->istring(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2122, __pyx_L1_error)

    /* "_pynini.pyx":2123
 *     while not self._paths.get().Done():
 *       yield self.istring()
 *       self._paths.get().Next()             # <<<<<<<<<<<<<<
 * 
 *   def items(self):
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2123, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_self->_paths.get()->Next();
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":2109
 *     return self._paths.get().IString()
 * 
 *   def istrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     istrings(self)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("istrings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_19generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":2125
 *       self._paths.get().Next()
 * 
 *   def items(self):             # <<<<<<<<<<<<<<
 *      """
 *      items(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_18items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_17items[] = "\n     items(self)\n\n     Generates all (istring, ostring, weight) triples in the FST.\n\n     This method returns a generator over all triples of input strings, \n     output strings, and path weights. The caller is responsible for resetting\n     the iterator if desired.\n\n     Yields:\n        All (istring, ostring, weight) triples.\n     ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_18items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_17items(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_17items(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)__pyx_tp_new_7_pynini___pyx_scope_struct_10_items(__pyx_ptype_7_pynini___pyx_scope_struct_10_items, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2125, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_19_StringPathIterator_19generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_items, __pyx_n_s_StringPathIterator_items, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 2125, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini._StringPathIterator.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_19generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2125, __pyx_L1_error)

  /* "_pynini.pyx":2138
 *         All (istring, ostring, weight) triples.
 *      """
 *      while not self._paths.get().Done():             # <<<<<<<<<<<<<<
 *        yield (self.istring(), self.ostring(), self.weight())
 *        self._paths.get().Next()
 */
  while (1) {
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2138, __pyx_L1_error)
    }
    __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->_paths.get()->Done() != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "_pynini.pyx":2139
 *      """
 *      while not self._paths.get().Done():
 *        yield (self.istring(), self.ostring(), self.weight())             # <<<<<<<<<<<<<<
 *        self._paths.get().Next()
 * 
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "istring");
      __PYX_ERR(0, 2139, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->istring(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "ostring");
      __PYX_ERR(0, 2139, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->ostring(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight");
      __PYX_ERR(0, 2139, __pyx_L1_error)
    }
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->weight(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2139, __pyx_L1_error)

    /* "_pynini.pyx":2140
 *      while not self._paths.get().Done():
 *        yield (self.istring(), self.ostring(), self.weight())
 *        self._paths.get().Next()             # <<<<<<<<<<<<<<
 * 
 *   cpdef void next(self):
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2140, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_self->_paths.get()->Next();
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":2125
 *       self._paths.get().Next()
 * 
 *   def items(self):             # <<<<<<<<<<<<<<
 *      """
 *      items(self)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2142
 *        self._paths.get().Next()
 * 
 *   cpdef void next(self):             # <<<<<<<<<<<<<<
 *     """
 *     next(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static void __pyx_f_7_pynini_19_StringPathIterator_next(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  __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("next", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_21next)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2142, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2148
 *     Advances the iterator.
 *     """
 *     self._paths.get().Next()             # <<<<<<<<<<<<<<
 * 
 *   cpdef void reset(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2148, __pyx_L1_error)
  }
  __pyx_v_self->_paths.get()->Next();

  /* "_pynini.pyx":2142
 *        self._paths.get().Next()
 * 
 *   cpdef void next(self):             # <<<<<<<<<<<<<<
 *     """
 *     next(self)
 */

  /* function exit 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_WriteUnraisable("_pynini._StringPathIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_20next[] = "\n    next(self)\n\n    Advances the iterator.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_21next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_20next(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_20next(struct __pyx_obj_7_pynini__StringPathIterator *__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("next", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_19_StringPathIterator_next(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2150
 *     self._paths.get().Next()
 * 
 *   cpdef void reset(self):             # <<<<<<<<<<<<<<
 *     """
 *     reset(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static void __pyx_f_7_pynini_19_StringPathIterator_reset(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  __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("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_23reset)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2150, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2156
 *     Resets the iterator to the initial position.
 *     """
 *     self._paths.get().Reset()             # <<<<<<<<<<<<<<
 * 
 *   cpdef string ostring(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2156, __pyx_L1_error)
  }
  __pyx_v_self->_paths.get()->Reset();

  /* "_pynini.pyx":2150
 *     self._paths.get().Next()
 * 
 *   cpdef void reset(self):             # <<<<<<<<<<<<<<
 *     """
 *     reset(self)
 */

  /* function exit 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_WriteUnraisable("_pynini._StringPathIterator.reset", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_22reset[] = "\n    reset(self)\n\n    Resets the iterator to the initial position.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_23reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_22reset(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_22reset(struct __pyx_obj_7_pynini__StringPathIterator *__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("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_19_StringPathIterator_reset(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2158
 *     self._paths.get().Reset()
 * 
 *   cpdef string ostring(self):             # <<<<<<<<<<<<<<
 *     """
 *     ostring(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_25ostring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_19_StringPathIterator_ostring(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ostring", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_25ostring)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2158, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2158, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2167
 *       The path's output string.
 *     """
 *     return self._paths.get().OString()             # <<<<<<<<<<<<<<
 * 
 *   def ostrings(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2167, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_paths.get()->OString();
  goto __pyx_L0;

  /* "_pynini.pyx":2158
 *     self._paths.get().Reset()
 * 
 *   cpdef string ostring(self):             # <<<<<<<<<<<<<<
 *     """
 *     ostring(self)
 */

  /* 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_WriteUnraisable("_pynini._StringPathIterator.ostring", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_25ostring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_24ostring[] = "\n    ostring(self)\n\n    Returns the current path's output string.\n\n    Returns:\n      The path's output string.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_25ostring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ostring (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_24ostring(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_24ostring(struct __pyx_obj_7_pynini__StringPathIterator *__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("ostring", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_7_pynini_19_StringPathIterator_ostring(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._StringPathIterator.ostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_28generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":2169
 *     return self._paths.get().OString()
 * 
 *   def ostrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     ostrings(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_27ostrings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_26ostrings[] = "\n    ostrings(self)\n\n    Generates all output strings in the FST.\n\n    This method returns a generator over all output strings in the path. The\n    caller is responsible for resetting the iterator if desired.\n\n    Yields:\n      All output strings.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_27ostrings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ostrings (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_26ostrings(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_26ostrings(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ostrings", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)__pyx_tp_new_7_pynini___pyx_scope_struct_11_ostrings(__pyx_ptype_7_pynini___pyx_scope_struct_11_ostrings, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2169, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_19_StringPathIterator_28generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_ostrings, __pyx_n_s_StringPathIterator_ostrings, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 2169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini._StringPathIterator.ostrings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_28generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ostrings", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2169, __pyx_L1_error)

  /* "_pynini.pyx":2181
 *       All output strings.
 *     """
 *     while not self._paths.get().Done():             # <<<<<<<<<<<<<<
 *       yield self.ostring()
 *       self._paths.get().Next()
 */
  while (1) {
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2181, __pyx_L1_error)
    }
    __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->_paths.get()->Done() != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "_pynini.pyx":2182
 *     """
 *     while not self._paths.get().Done():
 *       yield self.ostring()             # <<<<<<<<<<<<<<
 *       self._paths.get().Next()
 * 
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "ostring");
      __PYX_ERR(0, 2182, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->ostring(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2182, __pyx_L1_error)

    /* "_pynini.pyx":2183
 *     while not self._paths.get().Done():
 *       yield self.ostring()
 *       self._paths.get().Next()             # <<<<<<<<<<<<<<
 * 
 *   cpdef _Weight weight(self):
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2183, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_self->_paths.get()->Next();
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":2169
 *     return self._paths.get().OString()
 * 
 *   def ostrings(self):             # <<<<<<<<<<<<<<
 *     """
 *     ostrings(self)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("ostrings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2185
 *       self._paths.get().Next()
 * 
 *   cpdef _Weight weight(self):             # <<<<<<<<<<<<<<
 *     """
 *     weight(self)
 */

static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_30weight(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_10_pywrapfst_Weight *__pyx_f_7_pynini_19_StringPathIterator_weight(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_10_pywrapfst_Weight *__pyx_v_weight = 0;
  struct __pyx_obj_10_pywrapfst_Weight *__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("weight", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_weight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_19_StringPathIterator_30weight)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10_pywrapfst_Weight))))) __PYX_ERR(0, 2185, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_10_pywrapfst_Weight *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2194
 *       The path's Weight.
 *     """
 *     cdef _Weight weight = _Weight.__new__(_Weight)             # <<<<<<<<<<<<<<
 *     weight._weight.reset(new WeightClass(self._paths.get().Weight()))
 *     return weight
 */
  __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_ptype_10_pywrapfst_Weight), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_Weight)))) __PYX_ERR(0, 2194, __pyx_L1_error)
  __pyx_v_weight = ((struct __pyx_obj_10_pywrapfst_Weight *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":2195
 *     """
 *     cdef _Weight weight = _Weight.__new__(_Weight)
 *     weight._weight.reset(new WeightClass(self._paths.get().Weight()))             # <<<<<<<<<<<<<<
 *     return weight
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_weight) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_weight");
    __PYX_ERR(0, 2195, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
    __PYX_ERR(0, 2195, __pyx_L1_error)
  }
  __pyx_v_weight->_weight.reset(new fst::script::WeightClass(__pyx_v_self->_paths.get()->Weight()));

  /* "_pynini.pyx":2196
 *     cdef _Weight weight = _Weight.__new__(_Weight)
 *     weight._weight.reset(new WeightClass(self._paths.get().Weight()))
 *     return weight             # <<<<<<<<<<<<<<
 * 
 *   def weights(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_weight));
  __pyx_r = __pyx_v_weight;
  goto __pyx_L0;

  /* "_pynini.pyx":2185
 *       self._paths.get().Next()
 * 
 *   cpdef _Weight weight(self):             # <<<<<<<<<<<<<<
 *     """
 *     weight(self)
 */

  /* 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("_pynini._StringPathIterator.weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_weight);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_30weight(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_29weight[] = "\n    weight(self)\n\n    Returns the current path's total weight.\n\n    Returns:\n      The path's Weight.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_30weight(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("weight (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_29weight(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_29weight(struct __pyx_obj_7_pynini__StringPathIterator *__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("weight", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_19_StringPathIterator_weight(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._StringPathIterator.weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_33generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "_pynini.pyx":2198
 *     return weight
 * 
 *   def weights(self):             # <<<<<<<<<<<<<<
 *     """
 *     weights(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_32weights(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_19_StringPathIterator_31weights[] = "\n    weights(self)\n\n    Generates all path weights in the FST.\n\n    This method returns a generator over all path weights. The caller is\n    responsible for resetting the iterator if desired.\n\n    Yields:\n      All weights.\n    ";
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_32weights(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("weights (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_31weights(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_31weights(struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("weights", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)__pyx_tp_new_7_pynini___pyx_scope_struct_12_weights(__pyx_ptype_7_pynini___pyx_scope_struct_12_weights, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2198, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7_pynini_19_StringPathIterator_33generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_weights, __pyx_n_s_StringPathIterator_weights, __pyx_n_s_pynini); if (unlikely(!gen)) __PYX_ERR(0, 2198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("_pynini._StringPathIterator.weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7_pynini_19_StringPathIterator_33generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *__pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("weights", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2198, __pyx_L1_error)

  /* "_pynini.pyx":2210
 *       All weights.
 *     """
 *     while not self._paths.get().Done():             # <<<<<<<<<<<<<<
 *       yield self.weight()
 *       self._paths.get().Next()
 */
  while (1) {
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2210, __pyx_L1_error)
    }
    __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->_paths.get()->Done() != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "_pynini.pyx":2211
 *     """
 *     while not self._paths.get().Done():
 *       yield self.weight()             # <<<<<<<<<<<<<<
 *       self._paths.get().Next()
 * 
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "weight");
      __PYX_ERR(0, 2211, __pyx_L1_error)
    }
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini__StringPathIterator *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->weight(__pyx_cur_scope->__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2211, __pyx_L1_error)

    /* "_pynini.pyx":2212
 *     while not self._paths.get().Done():
 *       yield self.weight()
 *       self._paths.get().Next()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_paths");
      __PYX_ERR(0, 2212, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_self->_paths.get()->Next();
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "_pynini.pyx":2198
 *     return weight
 * 
 *   def weights(self):             # <<<<<<<<<<<<<<
 *     """
 *     weights(self)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_35__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_35__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_34__reduce_cython__(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_34__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__StringPathIterator *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._StringPathIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_37__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_19_StringPathIterator_37__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_19_StringPathIterator_36__setstate_cython__(((struct __pyx_obj_7_pynini__StringPathIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7_pynini_19_StringPathIterator_36__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7_pynini__StringPathIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_pynini._StringPathIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2243
 *   # Instances holds either a FarReader or a FarWriter.
 * 
 *   def __init__(self,             # <<<<<<<<<<<<<<
 *                filename,
 *                mode="r",
 */

/* Python wrapper */
static int __pyx_pw_7_pynini_3Far_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7_pynini_3Far_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_arc_type = 0;
  PyObject *__pyx_v_far_type = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,&__pyx_n_s_arc_type,&__pyx_n_s_far_type,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_r);
    values[2] = ((PyObject *)__pyx_n_u_standard);
    values[3] = ((PyObject *)__pyx_n_u_default);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename)) != 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_mode);
          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_arc_type);
          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_far_type);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2243, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_filename = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_arc_type = values[2];
    __pyx_v_far_type = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2243, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Far.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Far___init__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_arc_type, __pyx_v_far_type);

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

static int __pyx_pf_7_pynini_3Far___init__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_arc_type, PyObject *__pyx_v_far_type) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "_pynini.pyx":2248
 *                arc_type="standard",
 *                far_type="default"):
 *     self._name = path_tostring(filename)             # <<<<<<<<<<<<<<
 *     self._mode = tostring(mode)[0]
 *     if self._mode == b"r":
 */
  __pyx_t_1 = __pyx_f_10_pywrapfst_path_tostring(__pyx_v_filename); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2248, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
    __PYX_ERR(0, 2248, __pyx_L1_error)
  }
  __pyx_v_self->_name = __pyx_t_1;

  /* "_pynini.pyx":2249
 *                far_type="default"):
 *     self._name = path_tostring(filename)
 *     self._mode = tostring(mode)[0]             # <<<<<<<<<<<<<<
 *     if self._mode == b"r":
 *       self._reader = FarReader.open(self._name)
 */
  __pyx_t_1 = __pyx_f_10_pywrapfst_tostring(__pyx_v_mode); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2249, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2249, __pyx_L1_error)
  }
  __pyx_v_self->_mode = (__pyx_t_1[0]);

  /* "_pynini.pyx":2250
 *     self._name = path_tostring(filename)
 *     self._mode = tostring(mode)[0]
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2250, __pyx_L1_error)
  }
  __pyx_t_2 = ((__pyx_v_self->_mode == 'r') != 0);
  if (__pyx_t_2) {

    /* "_pynini.pyx":2251
 *     self._mode = tostring(mode)[0]
 *     if self._mode == b"r":
 *       self._reader = FarReader.open(self._name)             # <<<<<<<<<<<<<<
 *     elif self._mode == b"w":
 *       self._writer = FarWriter.create(self._name,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10_pywrapfst_FarReader), __pyx_n_s_open); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
      __PYX_ERR(0, 2251, __pyx_L1_error)
    }
    __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10_pywrapfst_FarReader))))) __PYX_ERR(0, 2251, __pyx_L1_error)
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
      __PYX_ERR(0, 2251, __pyx_L1_error)
    }
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_reader);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_reader));
    __pyx_v_self->_reader = ((struct __pyx_obj_10_pywrapfst_FarReader *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "_pynini.pyx":2250
 *     self._name = path_tostring(filename)
 *     self._mode = tostring(mode)[0]
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":2252
 *     if self._mode == b"r":
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       self._writer = FarWriter.create(self._name,
 *                                       arc_type=arc_type,
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2252, __pyx_L1_error)
  }
  __pyx_t_2 = ((__pyx_v_self->_mode == 'w') != 0);
  if (likely(__pyx_t_2)) {

    /* "_pynini.pyx":2253
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":
 *       self._writer = FarWriter.create(self._name,             # <<<<<<<<<<<<<<
 *                                       arc_type=arc_type,
 *                                       far_type=far_type)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10_pywrapfst_FarWriter), __pyx_n_s_create); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
      __PYX_ERR(0, 2253, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "_pynini.pyx":2254
 *     elif self._mode == b"w":
 *       self._writer = FarWriter.create(self._name,
 *                                       arc_type=arc_type,             # <<<<<<<<<<<<<<
 *                                       far_type=far_type)
 *     else:
 */
    __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_arc_type, __pyx_v_arc_type) < 0) __PYX_ERR(0, 2254, __pyx_L1_error)

    /* "_pynini.pyx":2255
 *       self._writer = FarWriter.create(self._name,
 *                                       arc_type=arc_type,
 *                                       far_type=far_type)             # <<<<<<<<<<<<<<
 *     else:
 *       raise FstArgError(f"Unknown mode: {mode}")
 */
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_far_type, __pyx_v_far_type) < 0) __PYX_ERR(0, 2254, __pyx_L1_error)

    /* "_pynini.pyx":2253
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":
 *       self._writer = FarWriter.create(self._name,             # <<<<<<<<<<<<<<
 *                                       arc_type=arc_type,
 *                                       far_type=far_type)
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_10_pywrapfst_FarWriter))))) __PYX_ERR(0, 2253, __pyx_L1_error)
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(0, 2253, __pyx_L1_error)
    }
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->_writer);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_writer));
    __pyx_v_self->_writer = ((struct __pyx_obj_10_pywrapfst_FarWriter *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "_pynini.pyx":2252
 *     if self._mode == b"r":
 *       self._reader = FarReader.open(self._name)
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       self._writer = FarWriter.create(self._name,
 *                                       arc_type=arc_type,
 */
    goto __pyx_L3;
  }

  /* "_pynini.pyx":2257
 *                                       far_type=far_type)
 *     else:
 *       raise FstArgError(f"Unknown mode: {mode}")             # <<<<<<<<<<<<<<
 * 
 *   def __repr__(self):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_mode, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2257, __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 && 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_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __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_6)) __PYX_ERR(0, 2257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(0, 2257, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "_pynini.pyx":2243
 *   # Instances holds either a FarReader or a FarWriter.
 * 
 *   def __init__(self,             # <<<<<<<<<<<<<<
 *                filename,
 *                mode="r",
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("_pynini.Far.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2259
 *       raise FstArgError(f"Unknown mode: {mode}")
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return (f"<{self.far_type()} Far {self._name}, "
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_2__repr__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_2__repr__(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_UCS4 __pyx_t_3;
  std::string __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "_pynini.pyx":2260
 * 
 *   def __repr__(self):
 *     return (f"<{self.far_type()} Far {self._name}, "             # <<<<<<<<<<<<<<
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__16);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__16);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__16);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "far_type");
    __PYX_ERR(0, 2260, __pyx_L1_error)
  }
  __pyx_t_4 = ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->far_type(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2260, __pyx_L1_error)
  __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_Far);
  __pyx_t_2 += 5;
  __Pyx_GIVEREF(__pyx_kp_u_Far);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Far);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
    __PYX_ERR(0, 2260, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u_mode_2);
  __pyx_t_2 += 8;
  __Pyx_GIVEREF(__pyx_kp_u_mode_2);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_mode_2);

  /* "_pynini.pyx":2261
 *   def __repr__(self):
 *     return (f"<{self.far_type()} Far {self._name}, "
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")             # <<<<<<<<<<<<<<
 * 
 *   cdef void _check_open(self) except *:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2261, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyInt_From_char(__pyx_v_self->_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u_at_0x_2);
  __pyx_t_2 += 7;
  __Pyx_GIVEREF(__pyx_kp_u_at_0x_2);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_at_0x_2);
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_6, __pyx_n_u_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u__3);

  /* "_pynini.pyx":2260
 * 
 *   def __repr__(self):
 *     return (f"<{self.far_type()} Far {self._name}, "             # <<<<<<<<<<<<<<
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 * 
 */
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2259
 *       raise FstArgError(f"Unknown mode: {mode}")
 * 
 *   def __repr__(self):             # <<<<<<<<<<<<<<
 *     return (f"<{self.far_type()} Far {self._name}, "
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("_pynini.Far.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2263
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 * 
 *   cdef void _check_open(self) except *:             # <<<<<<<<<<<<<<
 *     if self.closed():
 *       raise ValueError("I/O operation on closed FAR")
 */

static void __pyx_f_7_pynini_3Far__check_open(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_open", 0);

  /* "_pynini.pyx":2264
 * 
 *   cdef void _check_open(self) except *:
 *     if self.closed():             # <<<<<<<<<<<<<<
 *       raise ValueError("I/O operation on closed FAR")
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "closed");
    __PYX_ERR(0, 2264, __pyx_L1_error)
  }
  __pyx_t_1 = (((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->closed(__pyx_v_self, 0) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":2265
 *   cdef void _check_open(self) except *:
 *     if self.closed():
 *       raise ValueError("I/O operation on closed FAR")             # <<<<<<<<<<<<<<
 * 
 *   cdef void _check_mode(self, char mode) except *:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 2265, __pyx_L1_error)

    /* "_pynini.pyx":2264
 * 
 *   cdef void _check_open(self) except *:
 *     if self.closed():             # <<<<<<<<<<<<<<
 *       raise ValueError("I/O operation on closed FAR")
 * 
 */
  }

  /* "_pynini.pyx":2263
 *             f"mode '{self._mode:c}' at 0x{id(self):x}>")
 * 
 *   cdef void _check_open(self) except *:             # <<<<<<<<<<<<<<
 *     if self.closed():
 *       raise ValueError("I/O operation on closed FAR")
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_pynini.Far._check_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_pynini.pyx":2267
 *       raise ValueError("I/O operation on closed FAR")
 * 
 *   cdef void _check_mode(self, char mode) except *:             # <<<<<<<<<<<<<<
 *     self._check_open()
 *     if not self._mode == mode:
 */

static void __pyx_f_7_pynini_3Far__check_mode(struct __pyx_obj_7_pynini_Far *__pyx_v_self, char __pyx_v_mode) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_mode", 0);

  /* "_pynini.pyx":2268
 * 
 *   cdef void _check_mode(self, char mode) except *:
 *     self._check_open()             # <<<<<<<<<<<<<<
 *     if not self._mode == mode:
 *       raise io.UnsupportedOperation(
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_open");
    __PYX_ERR(0, 2268, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_open(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2268, __pyx_L1_error)

  /* "_pynini.pyx":2269
 *   cdef void _check_mode(self, char mode) except *:
 *     self._check_open()
 *     if not self._mode == mode:             # <<<<<<<<<<<<<<
 *       raise io.UnsupportedOperation(
 *           f"not {'readable' if mode == b'r' else 'writable'}")
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2269, __pyx_L1_error)
  }
  __pyx_t_1 = ((!((__pyx_v_self->_mode == __pyx_v_mode) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "_pynini.pyx":2270
 *     self._check_open()
 *     if not self._mode == mode:
 *       raise io.UnsupportedOperation(             # <<<<<<<<<<<<<<
 *           f"not {'readable' if mode == b'r' else 'writable'}")
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "_pynini.pyx":2271
 *     if not self._mode == mode:
 *       raise io.UnsupportedOperation(
 *           f"not {'readable' if mode == b'r' else 'writable'}")             # <<<<<<<<<<<<<<
 * 
 *   # API shared between FarReader and FarWriter.
 */
    if (((__pyx_v_mode == 'r') != 0)) {
      __Pyx_INCREF(__pyx_n_u_readable);
      __pyx_t_3 = __pyx_n_u_readable;
    } else {
      __Pyx_INCREF(__pyx_n_u_writable);
      __pyx_t_3 = __pyx_n_u_writable;
    }
    __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_not, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2271, __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 && 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_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __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_2)) __PYX_ERR(0, 2270, __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, 2270, __pyx_L1_error)

    /* "_pynini.pyx":2269
 *   cdef void _check_mode(self, char mode) except *:
 *     self._check_open()
 *     if not self._mode == mode:             # <<<<<<<<<<<<<<
 *       raise io.UnsupportedOperation(
 *           f"not {'readable' if mode == b'r' else 'writable'}")
 */
  }

  /* "_pynini.pyx":2267
 *       raise ValueError("I/O operation on closed FAR")
 * 
 *   cdef void _check_mode(self, char mode) except *:             # <<<<<<<<<<<<<<
 *     self._check_open()
 *     if not self._mode == mode:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.Far._check_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_pynini.pyx":2275
 *   # API shared between FarReader and FarWriter.
 * 
 *   cpdef bool error(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     error(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_5error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static bool __pyx_f_7_pynini_3Far_error(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("error", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_5error)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2275, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2275, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2284
 *       True if the FAR is in an errorful state, False otherwise.
 *     """
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.error()
 *     elif self._mode == b"w":
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2284, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'r') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2285
 *     """
 *     if self._mode == b"r":
 *       return self._reader.error()             # <<<<<<<<<<<<<<
 *     elif self._mode == b"w":
 *       return self._writer.error()
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
      __PYX_ERR(0, 2285, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "error");
      __PYX_ERR(0, 2285, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->error(__pyx_v_self->_reader, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2284
 *       True if the FAR is in an errorful state, False otherwise.
 *     """
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.error()
 *     elif self._mode == b"w":
 */
  }

  /* "_pynini.pyx":2286
 *     if self._mode == b"r":
 *       return self._reader.error()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.error()
 *     else:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2286, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'w') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2287
 *       return self._reader.error()
 *     elif self._mode == b"w":
 *       return self._writer.error()             # <<<<<<<<<<<<<<
 *     else:
 *       return False
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(0, 2287, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "error");
      __PYX_ERR(0, 2287, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarWriter *)__pyx_v_self->_writer->__pyx_vtab)->error(__pyx_v_self->_writer, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2286
 *     if self._mode == b"r":
 *       return self._reader.error()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.error()
 *     else:
 */
  }

  /* "_pynini.pyx":2289
 *       return self._writer.error()
 *     else:
 *       return False             # <<<<<<<<<<<<<<
 * 
 *   cpdef string arc_type(self) except *:
 */
  /*else*/ {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "_pynini.pyx":2275
 *   # API shared between FarReader and FarWriter.
 * 
 *   cpdef bool error(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     error(self)
 */

  /* 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("_pynini.Far.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_5error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_4error[] = "\n    error(self)\n\n    Indicates whether the FAR has encountered an error.\n\n    Returns:\n      True if the FAR is in an errorful state, False otherwise.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_5error(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("error (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_4error(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_4error(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("error", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_error(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2275, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2291
 *       return False
 * 
 *   cpdef string arc_type(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     arc_type(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_3Far_arc_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arc_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_arc_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_7arc_type)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2300
 *       ValueError: FAR is closed.
 *     """
 *     self._check_open()             # <<<<<<<<<<<<<<
 *     if self._mode == b"r":
 *       return self._reader.arc_type()
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_open");
    __PYX_ERR(0, 2300, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_open(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2300, __pyx_L1_error)

  /* "_pynini.pyx":2301
 *     """
 *     self._check_open()
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.arc_type()
 *     elif self._mode == b"w":
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2301, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'r') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2302
 *     self._check_open()
 *     if self._mode == b"r":
 *       return self._reader.arc_type()             # <<<<<<<<<<<<<<
 *     elif self._mode == b"w":
 *       return self._writer.arc_type()
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
      __PYX_ERR(0, 2302, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
      __PYX_ERR(0, 2302, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->arc_type(__pyx_v_self->_reader, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2301
 *     """
 *     self._check_open()
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.arc_type()
 *     elif self._mode == b"w":
 */
  }

  /* "_pynini.pyx":2303
 *     if self._mode == b"r":
 *       return self._reader.arc_type()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.arc_type()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2303, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'w') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2304
 *       return self._reader.arc_type()
 *     elif self._mode == b"w":
 *       return self._writer.arc_type()             # <<<<<<<<<<<<<<
 * 
 *   cpdef bool closed(self):
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(0, 2304, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "arc_type");
      __PYX_ERR(0, 2304, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarWriter *)__pyx_v_self->_writer->__pyx_vtab)->arc_type(__pyx_v_self->_writer, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2303
 *     if self._mode == b"r":
 *       return self._reader.arc_type()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.arc_type()
 * 
 */
  }

  /* "_pynini.pyx":2291
 *       return False
 * 
 *   cpdef string arc_type(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     arc_type(self)
 */

  /* function exit code */
  __Pyx_pretend_to_initialize(&__pyx_r);
  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("_pynini.Far.arc_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_6arc_type[] = "\n    arc_type(self)\n\n    Returns a string indicating the arc type.\n\n    Raises:\n      ValueError: FAR is closed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_7arc_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arc_type (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_6arc_type(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_6arc_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arc_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_arc_type(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2306
 *       return self._writer.arc_type()
 * 
 *   cpdef bool closed(self):             # <<<<<<<<<<<<<<
 *     """
 *     closed(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static bool __pyx_f_7_pynini_3Far_closed(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("closed", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_closed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_9closed)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2306, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2306, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2312
 *     Indicates whether the FAR is closed for IO.
 *     """
 *     return self._mode == b"c"             # <<<<<<<<<<<<<<
 * 
 *   cpdef string far_type(self) except *:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2312, __pyx_L1_error)
  }
  __pyx_r = (__pyx_v_self->_mode == 'c');
  goto __pyx_L0;

  /* "_pynini.pyx":2306
 *       return self._writer.arc_type()
 * 
 *   cpdef bool closed(self):             # <<<<<<<<<<<<<<
 *     """
 *     closed(self)
 */

  /* 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_WriteUnraisable("_pynini.Far.closed", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_8closed[] = "\n    closed(self)\n\n    Indicates whether the FAR is closed for IO.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("closed (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_8closed(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_8closed(struct __pyx_obj_7_pynini_Far *__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("closed", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_7_pynini_3Far_closed(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2314
 *     return self._mode == b"c"
 * 
 *   cpdef string far_type(self) except *:             # <<<<<<<<<<<<<<
 *     """far_type(self)
 * 
 */

static PyObject *__pyx_pw_7_pynini_3Far_11far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_3Far_far_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("far_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_far_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2314, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_11far_type)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2314, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2314, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2322
 *       ValueError: FAR is closed.
 *     """
 *     self._check_open()             # <<<<<<<<<<<<<<
 *     if self._mode == b"r":
 *       return self._reader.far_type()
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_open");
    __PYX_ERR(0, 2322, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_open(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2322, __pyx_L1_error)

  /* "_pynini.pyx":2323
 *     """
 *     self._check_open()
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.far_type()
 *     elif self._mode == b"w":
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2323, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'r') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2324
 *     self._check_open()
 *     if self._mode == b"r":
 *       return self._reader.far_type()             # <<<<<<<<<<<<<<
 *     elif self._mode == b"w":
 *       return self._writer.far_type()
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
      __PYX_ERR(0, 2324, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "far_type");
      __PYX_ERR(0, 2324, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->far_type(__pyx_v_self->_reader, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2323
 *     """
 *     self._check_open()
 *     if self._mode == b"r":             # <<<<<<<<<<<<<<
 *       return self._reader.far_type()
 *     elif self._mode == b"w":
 */
  }

  /* "_pynini.pyx":2325
 *     if self._mode == b"r":
 *       return self._reader.far_type()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.far_type()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2325, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'w') != 0);
  if (__pyx_t_6) {

    /* "_pynini.pyx":2326
 *       return self._reader.far_type()
 *     elif self._mode == b"w":
 *       return self._writer.far_type()             # <<<<<<<<<<<<<<
 * 
 *   cpdef string mode(self):
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(0, 2326, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "far_type");
      __PYX_ERR(0, 2326, __pyx_L1_error)
    }
    __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarWriter *)__pyx_v_self->_writer->__pyx_vtab)->far_type(__pyx_v_self->_writer, 0);
    goto __pyx_L0;

    /* "_pynini.pyx":2325
 *     if self._mode == b"r":
 *       return self._reader.far_type()
 *     elif self._mode == b"w":             # <<<<<<<<<<<<<<
 *       return self._writer.far_type()
 * 
 */
  }

  /* "_pynini.pyx":2314
 *     return self._mode == b"c"
 * 
 *   cpdef string far_type(self) except *:             # <<<<<<<<<<<<<<
 *     """far_type(self)
 * 
 */

  /* function exit code */
  __Pyx_pretend_to_initialize(&__pyx_r);
  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("_pynini.Far.far_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_11far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_10far_type[] = "far_type(self)\n\n    Returns a string indicating the FAR type.\n\n    Raises:\n      ValueError: FAR is closed.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_11far_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("far_type (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_10far_type(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_10far_type(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("far_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_far_type(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2314, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2328
 *       return self._writer.far_type()
 * 
 *   cpdef string mode(self):             # <<<<<<<<<<<<<<
 *     """
 *     mode(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_13mode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_3Far_mode(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mode", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_13mode)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2328, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2334
 *     Returns a char indicating the FAR's current mode.
 *     """
 *     return f"{self._mode:c}"             # <<<<<<<<<<<<<<
 * 
 *   cpdef string name(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2334, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyInt_From_char(__pyx_v_self->_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_n_u_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "_pynini.pyx":2328
 *       return self._writer.far_type()
 * 
 *   cpdef string mode(self):             # <<<<<<<<<<<<<<
 *     """
 *     mode(self)
 */

  /* 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_WriteUnraisable("_pynini.Far.mode", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_13mode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_12mode[] = "\n    mode(self)\n\n    Returns a char indicating the FAR's current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_13mode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mode (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_12mode(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_12mode(struct __pyx_obj_7_pynini_Far *__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("mode", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_7_pynini_3Far_mode(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2336
 *     return f"{self._mode:c}"
 * 
 *   cpdef string name(self):             # <<<<<<<<<<<<<<
 *     """
 *     name(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_15name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_3Far_name(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("name", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_15name)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2336, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2342
 *     Returns the FAR's filename.
 *     """
 *     return self._name             # <<<<<<<<<<<<<<
 * 
 *   # FarReader API.
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
    __PYX_ERR(0, 2342, __pyx_L1_error)
  }
  __pyx_r = __pyx_v_self->_name;
  goto __pyx_L0;

  /* "_pynini.pyx":2336
 *     return f"{self._mode:c}"
 * 
 *   cpdef string name(self):             # <<<<<<<<<<<<<<
 *     """
 *     name(self)
 */

  /* 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_WriteUnraisable("_pynini.Far.name", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_15name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_14name[] = "\n    name(self)\n\n    Returns the FAR's filename.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_15name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("name (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_14name(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_14name(struct __pyx_obj_7_pynini_Far *__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("name", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_f_7_pynini_3Far_name(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2346
 *   # FarReader API.
 * 
 *   cpdef bool done(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     done(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_17done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static bool __pyx_f_7_pynini_3Far_done(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("done", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_17done)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2346, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2359
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     return self._reader.done()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2359, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2359, __pyx_L1_error)

  /* "_pynini.pyx":2360
 *     """
 *     self._check_mode(b"r")
 *     return self._reader.done()             # <<<<<<<<<<<<<<
 * 
 *   cpdef bool find(self, key) except *:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2360, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "done");
    __PYX_ERR(0, 2360, __pyx_L1_error)
  }
  __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->done(__pyx_v_self->_reader, 0);
  goto __pyx_L0;

  /* "_pynini.pyx":2346
 *   # FarReader API.
 * 
 *   cpdef bool done(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     done(self)
 */

  /* 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("_pynini.Far.done", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_17done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_16done[] = "\n    done(self)\n\n    Indicates whether the iterator is exhausted or not.\n\n    Returns:\n      True if the iterator is exhausted, False otherwise.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_17done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("done (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_16done(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_16done(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("done", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_done(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2362
 *     return self._reader.done()
 * 
 *   cpdef bool find(self, key) except *:             # <<<<<<<<<<<<<<
 *     """
 *     find(self, key)
 */

static PyObject *__pyx_pw_7_pynini_3Far_19find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static bool __pyx_f_7_pynini_3Far_find(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch) {
  bool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2362, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_19find)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2362, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2362, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2379
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     return self._reader.find(key)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2379, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2379, __pyx_L1_error)

  /* "_pynini.pyx":2380
 *     """
 *     self._check_mode(b"r")
 *     return self._reader.find(key)             # <<<<<<<<<<<<<<
 * 
 *   cpdef Fst get_fst(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2380, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "find");
    __PYX_ERR(0, 2380, __pyx_L1_error)
  }
  __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->find(__pyx_v_self->_reader, __pyx_v_key, 0);
  goto __pyx_L0;

  /* "_pynini.pyx":2362
 *     return self._reader.done()
 * 
 *   cpdef bool find(self, key) except *:             # <<<<<<<<<<<<<<
 *     """
 *     find(self, key)
 */

  /* 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("_pynini.Far.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_19find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7_pynini_3Far_18find[] = "\n    find(self, key)\n\n    Sets the current position to the first entry greater than or equal to the\n    key (a string) and indicates whether or not a match was found.\n\n    Args:\n      key: A string key.\n\n    Returns:\n      True if the key was found, False otherwise.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_19find(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_18find(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_7_pynini_3Far_18find(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_find(__pyx_v_self, __pyx_v_key, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2362, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2382
 *     return self._reader.find(key)
 * 
 *   cpdef Fst get_fst(self):             # <<<<<<<<<<<<<<
 *     """
 *     get_fst(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_21get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_7_pynini_Fst *__pyx_f_7_pynini_3Far_get_fst(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_7_pynini_Fst *__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("get_fst", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_fst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_21get_fst)) {
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 2382, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2396
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     return Fst.from_pywrapfst(self._reader.get_fst())
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2396, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2396, __pyx_L1_error)

  /* "_pynini.pyx":2397
 *     """
 *     self._check_mode(b"r")
 *     return Fst.from_pywrapfst(self._reader.get_fst())             # <<<<<<<<<<<<<<
 * 
 *   cpdef string get_key(self) except *:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_from_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2397, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get_fst");
    __PYX_ERR(0, 2397, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->get_fst(__pyx_v_self->_reader, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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, 2397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7_pynini_Fst))))) __PYX_ERR(0, 2397, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2382
 *     return self._reader.find(key)
 * 
 *   cpdef Fst get_fst(self):             # <<<<<<<<<<<<<<
 *     """
 *     get_fst(self)
 */

  /* 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("_pynini.Far.get_fst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_21get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_20get_fst[] = "\n    get_fst(self)\n\n    Returns the FST at the current position. If the FST is not mutable,\n    it is converted to a VectorFst.\n\n    Returns:\n      A copy of the FST at the current position.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_21get_fst(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_fst (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_20get_fst(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_20get_fst(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_fst", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini_3Far_get_fst(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2399
 *     return Fst.from_pywrapfst(self._reader.get_fst())
 * 
 *   cpdef string get_key(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     get_key(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_23get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static std::string __pyx_f_7_pynini_3Far_get_key(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_key", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_23get_key)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2399, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2412
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     return self._reader.get_key()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2412, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L1_error)

  /* "_pynini.pyx":2413
 *     """
 *     self._check_mode(b"r")
 *     return self._reader.get_key()             # <<<<<<<<<<<<<<
 * 
 *   cpdef void next(self) except *:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2413, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get_key");
    __PYX_ERR(0, 2413, __pyx_L1_error)
  }
  __pyx_r = ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->get_key(__pyx_v_self->_reader, 0);
  goto __pyx_L0;

  /* "_pynini.pyx":2399
 *     return Fst.from_pywrapfst(self._reader.get_fst())
 * 
 *   cpdef string get_key(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     get_key(self)
 */

  /* 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("_pynini.Far.get_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_23get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_22get_key[] = "\n    get_key(self)\n\n    Returns the string key at the current position.\n\n    Returns:\n      The string key at the current position.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_23get_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_key (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_22get_key(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_22get_key(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_key", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_pynini_3Far_get_key(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2399, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2415
 *     return self._reader.get_key()
 * 
 *   cpdef void next(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     next(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_25next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static void __pyx_f_7_pynini_3Far_next(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  __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("next", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_25next)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2415, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2425
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     self._reader.next()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2425, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L1_error)

  /* "_pynini.pyx":2426
 *     """
 *     self._check_mode(b"r")
 *     self._reader.next()             # <<<<<<<<<<<<<<
 * 
 *   cpdef void reset(self) except *:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2426, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "next");
    __PYX_ERR(0, 2426, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->next(__pyx_v_self->_reader, 0);

  /* "_pynini.pyx":2415
 *     return self._reader.get_key()
 * 
 *   cpdef void next(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     next(self)
 */

  /* function exit 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_AddTraceback("_pynini.Far.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_25next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_24next[] = "\n    next(self)\n\n    Advances the iterator.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_25next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_24next(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_24next(struct __pyx_obj_7_pynini_Far *__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("next", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_f_7_pynini_3Far_next(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2415, __pyx_L1_error)
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2428
 *     self._reader.next()
 * 
 *   cpdef void reset(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     reset(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static void __pyx_f_7_pynini_3Far_reset(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  __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("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_27reset)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2428, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2438
 *       io.UnsupportedOperation: Cannot invoke method in current mode.
 *     """
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     self._reader.reset()
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2438, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2438, __pyx_L1_error)

  /* "_pynini.pyx":2439
 *     """
 *     self._check_mode(b"r")
 *     self._reader.reset()             # <<<<<<<<<<<<<<
 * 
 *   def __getitem__(self, key):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2439, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "reset");
    __PYX_ERR(0, 2439, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->reset(__pyx_v_self->_reader, 0);

  /* "_pynini.pyx":2428
 *     self._reader.next()
 * 
 *   cpdef void reset(self) except *:             # <<<<<<<<<<<<<<
 *     """
 *     reset(self)
 */

  /* function exit 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_AddTraceback("_pynini.Far.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_26reset[] = "\n    reset(self)\n\n    Resets the iterator to the initial position.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_26reset(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_26reset(struct __pyx_obj_7_pynini_Far *__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("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_f_7_pynini_3Far_reset(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2428, __pyx_L1_error)
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2441
 *     self._reader.reset()
 * 
 *   def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *     if self.get_key() == tostring(key) or self._reader.find(key):
 *       return self.get_fst()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_28__getitem__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_7_pynini_3Far_28__getitem__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  std::string __pyx_t_2;
  std::string __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "_pynini.pyx":2442
 * 
 *   def __getitem__(self, key):
 *     if self.get_key() == tostring(key) or self._reader.find(key):             # <<<<<<<<<<<<<<
 *       return self.get_fst()
 *     else:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get_key");
    __PYX_ERR(0, 2442, __pyx_L1_error)
  }
  __pyx_t_2 = ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->get_key(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2442, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_10_pywrapfst_tostring(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2442, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_2 == __pyx_t_3) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2442, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_reader) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "find");
    __PYX_ERR(0, 2442, __pyx_L1_error)
  }
  __pyx_t_4 = (((struct __pyx_vtabstruct_10_pywrapfst_FarReader *)__pyx_v_self->_reader->__pyx_vtab)->find(__pyx_v_self->_reader, __pyx_v_key, 0) != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (likely(__pyx_t_1)) {

    /* "_pynini.pyx":2443
 *   def __getitem__(self, key):
 *     if self.get_key() == tostring(key) or self._reader.find(key):
 *       return self.get_fst()             # <<<<<<<<<<<<<<
 *     else:
 *       raise KeyError(key)
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get_fst");
      __PYX_ERR(0, 2443, __pyx_L1_error)
    }
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->get_fst(__pyx_v_self, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "_pynini.pyx":2442
 * 
 *   def __getitem__(self, key):
 *     if self.get_key() == tostring(key) or self._reader.find(key):             # <<<<<<<<<<<<<<
 *       return self.get_fst()
 *     else:
 */
  }

  /* "_pynini.pyx":2445
 *       return self.get_fst()
 *     else:
 *       raise KeyError(key)             # <<<<<<<<<<<<<<
 * 
 *   def __next__(self):
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 2445, __pyx_L1_error)
  }

  /* "_pynini.pyx":2441
 *     self._reader.reset()
 * 
 *   def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *     if self.get_key() == tostring(key) or self._reader.find(key):
 *       return self.get_fst()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.Far.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2447
 *       raise KeyError(key)
 * 
 *   def __next__(self):             # <<<<<<<<<<<<<<
 *     self._check_mode(b"r")
 *     key, fst = self._reader.__next__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_31__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_31__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_30__next__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_30__next__(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_fst = 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("__next__", 0);

  /* "_pynini.pyx":2448
 * 
 *   def __next__(self):
 *     self._check_mode(b"r")             # <<<<<<<<<<<<<<
 *     key, fst = self._reader.__next__()
 *     return (key, Fst.from_pywrapfst(fst))
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2448, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'r'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2448, __pyx_L1_error)

  /* "_pynini.pyx":2449
 *   def __next__(self):
 *     self._check_mode(b"r")
 *     key, fst = self._reader.__next__()             # <<<<<<<<<<<<<<
 *     return (key, Fst.from_pywrapfst(fst))
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(0, 2449, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_reader), __pyx_n_s_next_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2449, __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, 2449, __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, 2449, __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, 2449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2449, __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, 2449, __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, 2449, __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, 2449, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_key = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_fst = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "_pynini.pyx":2450
 *     self._check_mode(b"r")
 *     key, fst = self._reader.__next__()
 *     return (key, Fst.from_pywrapfst(fst))             # <<<<<<<<<<<<<<
 * 
 *   # This just registers this class as a possible iterator.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_from_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2450, __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_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_fst) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_fst);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_key);
  __Pyx_GIVEREF(__pyx_v_key);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "_pynini.pyx":2447
 *       raise KeyError(key)
 * 
 *   def __next__(self):             # <<<<<<<<<<<<<<
 *     self._check_mode(b"r")
 *     key, fst = self._reader.__next__()
 */

  /* 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("_pynini.Far.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_fst);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2453
 * 
 *   # This just registers this class as a possible iterator.
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_33__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_33__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_32__iter__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_32__iter__(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "_pynini.pyx":2454
 *   # This just registers this class as a possible iterator.
 *   def __iter__(self):
 *     return self             # <<<<<<<<<<<<<<
 * 
 *   # FarWriter API.
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "_pynini.pyx":2453
 * 
 *   # This just registers this class as a possible iterator.
 *   def __iter__(self):             # <<<<<<<<<<<<<<
 *     return self
 * 
 */

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

/* "_pynini.pyx":2458
 *   # FarWriter API.
 * 
 *   cpdef void add(self, key, Fst fst):             # <<<<<<<<<<<<<<
 *     """
 *     add(self, key, fst)
 */

static PyObject *__pyx_pw_7_pynini_3Far_35add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static void __pyx_f_7_pynini_3Far_add(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst, int __pyx_skip_dispatch) {
  __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("add", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_35add)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, ((PyObject *)__pyx_v_fst)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2458, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, ((PyObject *)__pyx_v_fst)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2458, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2458, __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_INCREF(__pyx_v_key);
          __Pyx_GIVEREF(__pyx_v_key);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_key);
          __Pyx_INCREF(((PyObject *)__pyx_v_fst));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_fst));
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_fst));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2476
 *       FstOpError: Incompatible or invalid arc type.
 *     """
 *     self._check_mode(b"w")             # <<<<<<<<<<<<<<
 *     self._writer.add(key, fst)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2476, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'w'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2476, __pyx_L1_error)

  /* "_pynini.pyx":2477
 *     """
 *     self._check_mode(b"w")
 *     self._writer.add(key, fst)             # <<<<<<<<<<<<<<
 * 
 *   def __setitem__(self, key, Fst fst):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
    __PYX_ERR(0, 2477, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
    __PYX_ERR(0, 2477, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_10_pywrapfst_FarWriter *)__pyx_v_self->_writer->__pyx_vtab)->add(__pyx_v_self->_writer, __pyx_v_key, ((struct __pyx_obj_10_pywrapfst_Fst *)__pyx_v_fst), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2477, __pyx_L1_error)

  /* "_pynini.pyx":2458
 *   # FarWriter API.
 * 
 *   cpdef void add(self, key, Fst fst):             # <<<<<<<<<<<<<<
 *     """
 *     add(self, key, fst)
 */

  /* function exit 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_6);
  __Pyx_WriteUnraisable("_pynini.Far.add", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_35add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_pynini_3Far_34add[] = "\n    add(self, key, fst)\n\n    Adds an FST to the FAR (when open for writing).\n\n    This methods adds an FST to the FAR which can be retrieved with the\n    specified string key.\n\n    Args:\n      key: The string used to key the input FST.\n      fst: The FST to write to the FAR.\n\n    Raises:\n      ValueError: FAR is closed.\n      io.UnsupportedOperation: Cannot invoke method in current mode.\n      FstOpError: Incompatible or invalid arc type.\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_35add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_fst = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_fst,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_key)) != 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_fst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, 1); __PYX_ERR(0, 2458, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 2458, __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_key = values[0];
    __pyx_v_fst = ((struct __pyx_obj_7_pynini_Fst *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2458, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Far.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fst), __pyx_ptype_7_pynini_Fst, 1, "fst", 0))) __PYX_ERR(0, 2458, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_3Far_34add(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), __pyx_v_key, __pyx_v_fst);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_pynini_3Far_34add(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst) {
  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("add", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_3Far_add(__pyx_v_self, __pyx_v_key, __pyx_v_fst, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2479
 *     self._writer.add(key, fst)
 * 
 *   def __setitem__(self, key, Fst fst):             # <<<<<<<<<<<<<<
 *     self._check_mode(b"w")
 *     self._writer[key] = fst
 */

/* Python wrapper */
static int __pyx_pw_7_pynini_3Far_37__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_fst); /*proto*/
static int __pyx_pw_7_pynini_3Far_37__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_fst) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fst), __pyx_ptype_7_pynini_Fst, 1, "fst", 0))) __PYX_ERR(0, 2479, __pyx_L1_error)
  __pyx_r = __pyx_pf_7_pynini_3Far_36__setitem__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((struct __pyx_obj_7_pynini_Fst *)__pyx_v_fst));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7_pynini_3Far_36__setitem__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_7_pynini_Fst *__pyx_v_fst) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "_pynini.pyx":2480
 * 
 *   def __setitem__(self, key, Fst fst):
 *     self._check_mode(b"w")             # <<<<<<<<<<<<<<
 *     self._writer[key] = fst
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_check_mode");
    __PYX_ERR(0, 2480, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->_check_mode(__pyx_v_self, 'w'); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L1_error)

  /* "_pynini.pyx":2481
 *   def __setitem__(self, key, Fst fst):
 *     self._check_mode(b"w")
 *     self._writer[key] = fst             # <<<<<<<<<<<<<<
 * 
 *   cpdef void close(self):
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
    __PYX_ERR(0, 2481, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2481, __pyx_L1_error)
  }
  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->_writer), __pyx_v_key, ((PyObject *)__pyx_v_fst)) < 0)) __PYX_ERR(0, 2481, __pyx_L1_error)

  /* "_pynini.pyx":2479
 *     self._writer.add(key, fst)
 * 
 *   def __setitem__(self, key, Fst fst):             # <<<<<<<<<<<<<<
 *     self._check_mode(b"w")
 *     self._writer[key] = fst
 */

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

/* "_pynini.pyx":2483
 *     self._writer[key] = fst
 * 
 *   cpdef void close(self):             # <<<<<<<<<<<<<<
 *     """
 *     close(self)
 */

static PyObject *__pyx_pw_7_pynini_3Far_39close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static void __pyx_f_7_pynini_3Far_close(struct __pyx_obj_7_pynini_Far *__pyx_v_self, int __pyx_skip_dispatch) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7_pynini_3Far_39close)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2483, __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;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "_pynini.pyx":2489
 *     Closes the FAR and flushes to disk (when open for writing).
 *     """
 *     if not self.closed() and self._mode == b"w":             # <<<<<<<<<<<<<<
 *       self._writer.close()
 *     self._mode = b"c"
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "closed");
    __PYX_ERR(0, 2489, __pyx_L1_error)
  }
  __pyx_t_6 = ((!(((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->closed(__pyx_v_self, 0) != 0)) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2489, __pyx_L1_error)
  }
  __pyx_t_6 = ((__pyx_v_self->_mode == 'w') != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "_pynini.pyx":2490
 *     """
 *     if not self.closed() and self._mode == b"w":
 *       self._writer.close()             # <<<<<<<<<<<<<<
 *     self._mode = b"c"
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(0, 2490, __pyx_L1_error)
    }
    if (unlikely(((PyObject *)__pyx_v_self->_writer) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "close");
      __PYX_ERR(0, 2490, __pyx_L1_error)
    }
    ((struct __pyx_vtabstruct_10_pywrapfst_FarWriter *)__pyx_v_self->_writer->__pyx_vtab)->close(__pyx_v_self->_writer);

    /* "_pynini.pyx":2489
 *     Closes the FAR and flushes to disk (when open for writing).
 *     """
 *     if not self.closed() and self._mode == b"w":             # <<<<<<<<<<<<<<
 *       self._writer.close()
 *     self._mode = b"c"
 */
  }

  /* "_pynini.pyx":2491
 *     if not self.closed() and self._mode == b"w":
 *       self._writer.close()
 *     self._mode = b"c"             # <<<<<<<<<<<<<<
 * 
 *   # Adds support for use as a PEP-343 context manager.
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(0, 2491, __pyx_L1_error)
  }
  __pyx_v_self->_mode = 'c';

  /* "_pynini.pyx":2483
 *     self._writer[key] = fst
 * 
 *   cpdef void close(self):             # <<<<<<<<<<<<<<
 *     """
 *     close(self)
 */

  /* function exit 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_WriteUnraisable("_pynini.Far.close", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_39close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7_pynini_3Far_38close[] = "\n    close(self)\n\n    Closes the FAR and flushes to disk (when open for writing).\n    ";
static PyObject *__pyx_pw_7_pynini_3Far_39close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_38close(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_38close(struct __pyx_obj_7_pynini_Far *__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("close", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_f_7_pynini_3Far_close(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "_pynini.pyx":2495
 *   # Adds support for use as a PEP-343 context manager.
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_41__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_41__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_40__enter__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

static PyObject *__pyx_pf_7_pynini_3Far_40__enter__(struct __pyx_obj_7_pynini_Far *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "_pynini.pyx":2496
 * 
 *   def __enter__(self):
 *     return self             # <<<<<<<<<<<<<<
 * 
 *   def __exit__(self, exc, value, tb):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "_pynini.pyx":2495
 *   # Adds support for use as a PEP-343 context manager.
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     return self
 * 
 */

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

/* "_pynini.pyx":2498
 *     return self
 * 
 *   def __exit__(self, exc, value, tb):             # <<<<<<<<<<<<<<
 *     self.close()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_43__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_43__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc,&__pyx_n_s_value,&__pyx_n_s_tb,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_exc)) != 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_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 2498, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 2498, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 2498, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_exc = values[0];
    __pyx_v_value = values[1];
    __pyx_v_tb = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2498, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.Far.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_3Far_42__exit__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), __pyx_v_exc, __pyx_v_value, __pyx_v_tb);

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

static PyObject *__pyx_pf_7_pynini_3Far_42__exit__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "_pynini.pyx":2499
 * 
 *   def __exit__(self, exc, value, tb):
 *     self.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "close");
    __PYX_ERR(0, 2499, __pyx_L1_error)
  }
  ((struct __pyx_vtabstruct_7_pynini_Far *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0);

  /* "_pynini.pyx":2498
 *     return self
 * 
 *   def __exit__(self, exc, value, tb):             # <<<<<<<<<<<<<<
 *     self.close()
 * 
 */

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

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

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_45__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_45__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_44__reduce_cython__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self));

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

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

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._mode, self._name, self._reader, self._writer)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyInt_From_char(__pyx_v_self->_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_self->_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __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_INCREF(((PyObject *)__pyx_v_self->_reader));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_reader));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_self->_reader));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_writer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_writer));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_self->_writer));
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._mode, self._name, self._reader, self._writer)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self._mode, self._name, self._reader, self._writer)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

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

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

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

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._reader is not None or self._writer is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, None), state
 */
  /*else*/ {
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
      __PYX_ERR(1, 11, __pyx_L1_error)
    }
    __pyx_t_4 = (((PyObject *)__pyx_v_self->_reader) != Py_None);
    __pyx_t_6 = (__pyx_t_4 != 0);
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L4_bool_binop_done;
    }
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
      __PYX_ERR(1, 11, __pyx_L1_error)
    }
    __pyx_t_6 = (((PyObject *)__pyx_v_self->_writer) != Py_None);
    __pyx_t_4 = (__pyx_t_6 != 0);
    __pyx_t_5 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_5;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._reader is not None or self._writer is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, None), state
 *     else:
 */
  __pyx_t_5 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":13
 *         use_setstate = self._reader is not None or self._writer is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_Far); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_213039201);
    __Pyx_GIVEREF(__pyx_int_213039201);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_213039201);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __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_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._reader is not None or self._writer is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, None), state
 *     else:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Far__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_Far); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_213039201);
    __Pyx_GIVEREF(__pyx_int_213039201);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_213039201);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini.Far.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Far__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_3Far_47__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7_pynini_3Far_47__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_3Far_46__setstate_cython__(((struct __pyx_obj_7_pynini_Far *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7_pynini_3Far_46__setstate_cython__(struct __pyx_obj_7_pynini_Far *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Far__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7_pynini___pyx_unpickle_Far__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Far, (type(self), 0xcb2b861, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Far__set_state(self, __pyx_state)
 */

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

/* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_55_copy_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_55_copy_patch = {"_copy_patch", (PyCFunction)__pyx_pw_7_pynini_55_copy_patch, METH_O, 0};
static PyObject *__pyx_pw_7_pynini_55_copy_patch(PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_copy_patch (wrapper)", 0);
  __pyx_r = __pyx_pf_7_pynini_54_copy_patch(__pyx_self, ((PyObject *)__pyx_v_fnc));

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

/* "_pynini.pyx":2623
 * def _copy_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_11_copy_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_11_copy_patch_1patch = {"patch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_11_copy_patch_1patch, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_11_copy_patch_1patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_arg1 = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("patch (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg1,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "patch") < 0)) __PYX_ERR(0, 2623, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_arg1 = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("patch", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2623, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("_pynini._copy_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_11_copy_patch_patch(__pyx_self, __pyx_v_arg1, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7_pynini_11_copy_patch_patch(PyObject *__pyx_self, PyObject *__pyx_v_arg1, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *__pyx_cur_scope;
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *__pyx_outer_scope;
  struct __pyx_obj_7_pynini_Fst *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("patch", 0);
  __pyx_outer_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "_pynini.pyx":2624
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 *     cdef Fst result = _compile_or_copy_Fst(arg1)             # <<<<<<<<<<<<<<
 *     fnc(result, *args, **kwargs)
 *     return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7_pynini__compile_or_copy_Fst(__pyx_v_arg1, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct __pyx_obj_7_pynini_Fst *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_pynini.pyx":2625
 *   def patch(arg1, *args, **kwargs):
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)             # <<<<<<<<<<<<<<
 *     return result
 *   return patch
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_fnc)) { __Pyx_RaiseClosureNameError("fnc"); __PYX_ERR(0, 2625, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_fnc, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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;

  /* "_pynini.pyx":2626
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)
 *     return result             # <<<<<<<<<<<<<<
 *   return patch
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "_pynini.pyx":2623
 * def _copy_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_pynini._copy_patch.patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */

static PyObject *__pyx_pf_7_pynini_54_copy_patch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fnc) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *__pyx_cur_scope;
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy_patch", 0);
  __pyx_cur_scope = (struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)__pyx_tp_new_7_pynini___pyx_scope_struct_13__copy_patch(__pyx_ptype_7_pynini___pyx_scope_struct_13__copy_patch, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2621, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_fnc = __pyx_v_fnc;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fnc);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fnc);

  /* "_pynini.pyx":2622
 * 
 * def _copy_patch(fnc):
 *   @functools.wraps(fnc)             # <<<<<<<<<<<<<<
 *   def patch(arg1, *args, **kwargs):
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2622, __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_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fnc) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_fnc);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":2623
 * def _copy_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_11_copy_patch_1patch, 0, __pyx_n_s_copy_patch_locals_patch, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_patch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_pynini.pyx":2627
 *     fnc(result, *args, **kwargs)
 *     return result
 *   return patch             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_patch);
  __pyx_r = __pyx_v_patch;
  goto __pyx_L0;

  /* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_pynini._copy_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_patch);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_PdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_57__pyx_unpickle_PdtParentheses(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_57__pyx_unpickle_PdtParentheses = {"__pyx_unpickle_PdtParentheses", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_57__pyx_unpickle_PdtParentheses, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_57__pyx_unpickle_PdtParentheses(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_PdtParentheses (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PdtParentheses", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PdtParentheses", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_PdtParentheses") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PdtParentheses", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_PdtParentheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_56__pyx_unpickle_PdtParentheses(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7_pynini_56__pyx_unpickle_PdtParentheses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_PdtParentheses", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x078cdb7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x078cdb7) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x078cdb7:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x078cdb7:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x07, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__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_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x078cdb7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_PdtParentheses), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7_pynini___pyx_unpickle_PdtParentheses__set_state(((struct __pyx_obj_7_pynini_PdtParentheses *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x078cdb7 = (_parens))" % __pyx_checksum)
 *     __pyx_result = PdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._parens = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_PdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_PdtParentheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7_pynini___pyx_unpickle_PdtParentheses__set_state(struct __pyx_obj_7_pynini_PdtParentheses *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<std::pair<int64_t,int64_t> >  __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_PdtParentheses__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._parens = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_v___pyx_result->_parens = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 1) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __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;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_PdtParentheses__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_MPdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_59__pyx_unpickle_MPdtParentheses(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_59__pyx_unpickle_MPdtParentheses = {"__pyx_unpickle_MPdtParentheses", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_59__pyx_unpickle_MPdtParentheses, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_59__pyx_unpickle_MPdtParentheses(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_MPdtParentheses (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MPdtParentheses", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MPdtParentheses", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_MPdtParentheses") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MPdtParentheses", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_MPdtParentheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_58__pyx_unpickle_MPdtParentheses(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7_pynini_58__pyx_unpickle_MPdtParentheses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MPdtParentheses", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7925043:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x7925043) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7925043:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x7925043:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x79, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__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_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7925043:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_MPdtParentheses), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7_pynini___pyx_unpickle_MPdtParentheses__set_state(((struct __pyx_obj_7_pynini_MPdtParentheses *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7925043 = (_assign, _parens))" % __pyx_checksum)
 *     __pyx_result = MPdtParentheses.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_MPdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_MPdtParentheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7_pynini___pyx_unpickle_MPdtParentheses__set_state(struct __pyx_obj_7_pynini_MPdtParentheses *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<int64_t>  __pyx_t_2;
  std::vector<std::pair<int64_t,int64_t> >  __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MPdtParentheses__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_vector_from_py_int64_t(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_assign");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_v___pyx_result->_assign = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_parens");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_v___pyx_result->_parens = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 2) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_MPdtParentheses__set_state(<MPdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MPdtParentheses__set_state(MPdtParentheses __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._assign = __pyx_state[0]; __pyx_result._parens = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_MPdtParentheses__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Far(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_pynini_61__pyx_unpickle_Far(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_pynini_61__pyx_unpickle_Far = {"__pyx_unpickle_Far", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_61__pyx_unpickle_Far, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_pynini_61__pyx_unpickle_Far(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Far (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Far", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Far", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Far") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Far", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_Far", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_pynini_60__pyx_unpickle_Far(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7_pynini_60__pyx_unpickle_Far(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Far", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xcb2b861:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xcb2b861) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xcb2b861:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 *     __pyx_result = Far.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xcb2b861:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Far.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xcb, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__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_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xcb2b861:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 *     __pyx_result = Far.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Far), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 *     __pyx_result = Far.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Far.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7_pynini___pyx_unpickle_Far__set_state(((struct __pyx_obj_7_pynini_Far *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xcb2b861 = (_mode, _name, _reader, _writer))" % __pyx_checksum)
 *     __pyx_result = Far.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Far(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_Far", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7_pynini___pyx_unpickle_Far__set_state(struct __pyx_obj_7_pynini_Far *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char __pyx_t_2;
  std::string __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Far__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_char(__pyx_t_1); if (unlikely((__pyx_t_2 == (char)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_mode");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_v___pyx_result->_mode = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_name");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_v___pyx_result->_name = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_FarReader))))) __PYX_ERR(1, 12, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_reader");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_reader);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->_reader));
  __pyx_v___pyx_result->_reader = ((struct __pyx_obj_10_pywrapfst_FarReader *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10_pywrapfst_FarWriter))))) __PYX_ERR(1, 12, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v___pyx_result) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "_writer");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_writer);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->_writer));
  __pyx_v___pyx_result->_writer = ((struct __pyx_obj_10_pywrapfst_FarWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 4) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Far__set_state(<Far> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Far__set_state(Far __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._mode = __pyx_state[0]; __pyx_result._name = __pyx_state[1]; __pyx_result._reader = __pyx_state[2]; __pyx_result._writer = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("_pynini.__pyx_unpickle_Far__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":158
 * 
 * @cname("__pyx_convert_pair_to_py_int64_t____int64_t")
 * cdef object __pyx_convert_pair_to_py_int64_t____int64_t(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return p.first, p.second
 * 
 */

static PyObject *__pyx_convert_pair_to_py_int64_t____int64_t(std::pair<int64_t,int64_t>  const &__pyx_v_p) {
  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("__pyx_convert_pair_to_py_int64_t____int64_t", 0);

  /* "pair.to_py":159
 * @cname("__pyx_convert_pair_to_py_int64_t____int64_t")
 * cdef object __pyx_convert_pair_to_py_int64_t____int64_t(const pair[X,Y]& p):
 *     return p.first, p.second             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 159, __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_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":158
 * 
 * @cname("__pyx_convert_pair_to_py_int64_t____int64_t")
 * cdef object __pyx_convert_pair_to_py_int64_t____int64_t(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return p.first, p.second
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_int64_t____int64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(const std::vector<std::pair<int64_t,int64_t> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_pair_to_py_int64_t____int64_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.from_py":145
 * 
 * @cname("__pyx_convert_pair_from_py_int64_t__and_int64_t")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_int64_t__and_int64_t(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](<X>x, <Y>y)
 */

static std::pair<int64_t,int64_t>  __pyx_convert_pair_from_py_int64_t__and_int64_t(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  std::pair<int64_t,int64_t>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  int64_t __pyx_t_5;
  int64_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_int64_t__and_int64_t", 0);

  /* "pair.from_py":146
 * @cname("__pyx_convert_pair_from_py_int64_t__and_int64_t")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_int64_t__and_int64_t(object o) except *:
 *     x, y = o             # <<<<<<<<<<<<<<
 *     return pair[X,Y](<X>x, <Y>y)
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
    PyObject* sequence = __pyx_v_o;
    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(1, 146, __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_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(1, 146, __pyx_L1_error)
    __pyx_t_4 = 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_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(1, 146, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pair.from_py":147
 * cdef pair[X,Y] __pyx_convert_pair_from_py_int64_t__and_int64_t(object o) except *:
 *     x, y = o
 *     return pair[X,Y](<X>x, <Y>y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_v_x); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_v_y); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error)
  __pyx_r = std::pair<int64_t,int64_t> (((int64_t)__pyx_t_5), ((int64_t)__pyx_t_6));
  goto __pyx_L0;

  /* "pair.from_py":145
 * 
 * @cname("__pyx_convert_pair_from_py_int64_t__and_int64_t")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_int64_t__and_int64_t(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](<X>x, <Y>y)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_int64_t__and_int64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::pair<int64_t,int64_t> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(PyObject *__pyx_v_o) {
  std::vector<std::pair<int64_t,int64_t> >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::pair<int64_t,int64_t> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::pair<int64_t,int64_t>  __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __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_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_pair_from_py_int64_t__and_int64_t(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::pair<int64_t,int64_t> )__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_pair_3c_int64_t_2c_int64_t_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int64_t")
 * cdef object __pyx_convert_vector_to_py_int64_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_int64_t(const std::vector<int64_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_int64_t", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_int64_t")
 * cdef object __pyx_convert_vector_to_py_int64_t(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __Pyx_PyInt_From_int64_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int64_t")
 * cdef object __pyx_convert_vector_to_py_int64_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_int64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_int64_t")
 * cdef vector[X] __pyx_convert_vector_from_py_int64_t(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<int64_t>  __pyx_convert_vector_from_py_int64_t(PyObject *__pyx_v_o) {
  std::vector<int64_t>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<int64_t>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int64_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_int64_t", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_int64_t(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __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_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((int64_t)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_int64_t(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_int64_t")
 * cdef vector[X] __pyx_convert_vector_from_py_int64_t(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_int64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  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("__pyx_convert_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  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("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  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("__pyx_convert_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  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("__pyx_convert_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  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("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":14
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0             # <<<<<<<<<<<<<<
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)
 */
  __pyx_v_length = 0;

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) {
  std::vector<std::string>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __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_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __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(1, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::string)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7_pynini_Fst __pyx_vtable_7_pynini_Fst;

static PyObject *__pyx_tp_new_7_pynini_Fst(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7_pynini_Fst *p;
  PyObject *o = __pyx_ptype_10_pywrapfst_VectorFst->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini_Fst *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10_pywrapfst_Fst*)__pyx_vtabptr_7_pynini_Fst;
  return o;
}

static void __pyx_tp_dealloc_7_pynini_Fst(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  if (likely(__pyx_ptype_10_pywrapfst_VectorFst)) __pyx_ptype_10_pywrapfst_VectorFst->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_7_pynini_Fst);
}

static PyObject *__pyx_tp_richcompare_7_pynini_Fst(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_7_pynini_3Fst_25__eq__(o1, o2);
    }
    case Py_NE: {
      return __pyx_pw_7_pynini_3Fst_27__ne__(o1, o2);
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_7_pynini_3Fst_plus(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7_pynini_3Fst_4plus_1__get__(o);
}

static PyObject *__pyx_getprop_7_pynini_3Fst_ques(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7_pynini_3Fst_4ques_1__get__(o);
}

static PyObject *__pyx_getprop_7_pynini_3Fst_star(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7_pynini_3Fst_4star_1__get__(o);
}

static PyMethodDef __pyx_methods_7_pynini_Fst[] = {
  {"from_pywrapfst", (PyCFunction)__pyx_pw_7_pynini_3Fst_3from_pywrapfst, METH_O, __pyx_doc_7_pynini_3Fst_2from_pywrapfst},
  {"read", (PyCFunction)__pyx_pw_7_pynini_3Fst_5read, METH_O, __pyx_doc_7_pynini_3Fst_4read},
  {"read_from_string", (PyCFunction)__pyx_pw_7_pynini_3Fst_7read_from_string, METH_O, __pyx_doc_7_pynini_3Fst_6read_from_string},
  {"__reduce__", (PyCFunction)__pyx_pw_7_pynini_3Fst_9__reduce__, METH_NOARGS, 0},
  {"paths", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Fst_11paths, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_3Fst_10paths},
  {"string", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Fst_13string, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_3Fst_12string},
  {"copy", (PyCFunction)__pyx_pw_7_pynini_3Fst_15copy, METH_NOARGS, __pyx_doc_7_pynini_3Fst_14copy},
  {"closure", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Fst_17closure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_3Fst_16closure},
  {"concat", (PyCFunction)__pyx_pw_7_pynini_3Fst_19concat, METH_O, __pyx_doc_7_pynini_3Fst_18concat},
  {"optimize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Fst_21optimize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_3Fst_20optimize},
  {"union", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Fst_23union, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7_pynini_Fst[] = {
  {(char *)"plus", __pyx_getprop_7_pynini_3Fst_plus, 0, (char *)"\n    plus(self)\n\n    Constructively computes +-closure.\n\n    Returns:\n      An FST copy.\n    ", 0},
  {(char *)"ques", __pyx_getprop_7_pynini_3Fst_ques, 0, (char *)"\n    ques(self)\n\n    Constructively computes ?-closure.\n\n    Returns:\n      An FST copy.\n    ", 0},
  {(char *)"star", __pyx_getprop_7_pynini_3Fst_star, 0, (char *)"\n    star(self)\n\n    Constructively computes *-closure.\n\n    Returns:\n      An FST copy.\n    ", 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Fst = {
  __pyx_pw_7_pynini_3Fst_29__add__, /*nb_add*/
  __pyx_pw_7_pynini_3Fst_33__sub__, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  __pyx_pw_7_pynini_3Fst_35__pow__, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  __pyx_pw_7_pynini_3Fst_39__or__, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  __pyx_pw_7_pynini_3Fst_31__iadd__, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  __pyx_pw_7_pynini_3Fst_41__ior__, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  __pyx_pw_7_pynini_3Fst_37__matmul__, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_7_pynini_Fst = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.Fst", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini_Fst), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini_Fst, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Fst, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n  Fst(arc_type=\"standard\")\n\n  This class wraps a mutable FST and exposes all destructive methods.\n\n  Args:\n    arc_type: An optional string indicating the arc type for the FST.\n  ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_7_pynini_Fst, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7_pynini_Fst, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7_pynini_Fst, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7_pynini_3Fst_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini_Fst, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_7_pynini__PointerSymbolTableView __pyx_vtable_7_pynini__PointerSymbolTableView;

static PyObject *__pyx_tp_new_7_pynini__PointerSymbolTableView(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7_pynini__PointerSymbolTableView *p;
  PyObject *o = __pyx_ptype_10_pywrapfst_SymbolTableView->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini__PointerSymbolTableView *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView*)__pyx_vtabptr_7_pynini__PointerSymbolTableView;
  return o;
}

static void __pyx_tp_dealloc_7_pynini__PointerSymbolTableView(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  if (likely(__pyx_ptype_10_pywrapfst_SymbolTableView)) __pyx_ptype_10_pywrapfst_SymbolTableView->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_7_pynini__PointerSymbolTableView);
}

static PyMethodDef __pyx_methods_7_pynini__PointerSymbolTableView[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7_pynini_23_PointerSymbolTableView_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7_pynini_23_PointerSymbolTableView_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7_pynini__PointerSymbolTableView = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini._PointerSymbolTableView", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini__PointerSymbolTableView), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini__PointerSymbolTableView, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7_pynini_23_PointerSymbolTableView_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n  (No constructor.)\n\n  Immutable SymbolTable class for unowned tables.\n\n  This class wraps a library const SymbolTable pointer, and is used to wrap\n  the generated symbols table singleton.\n  ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7_pynini__PointerSymbolTableView, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini__PointerSymbolTableView, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_7_pynini_PdtParentheses __pyx_vtable_7_pynini_PdtParentheses;

static PyObject *__pyx_tp_new_7_pynini_PdtParentheses(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7_pynini_PdtParentheses *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini_PdtParentheses *)o);
  p->__pyx_vtab = __pyx_vtabptr_7_pynini_PdtParentheses;
  new((void*)&(p->_parens)) std::vector<std::pair<int64_t,int64_t> > ();
  return o;
}

static void __pyx_tp_dealloc_7_pynini_PdtParentheses(PyObject *o) {
  struct __pyx_obj_7_pynini_PdtParentheses *p = (struct __pyx_obj_7_pynini_PdtParentheses *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->_parens);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7_pynini_PdtParentheses[] = {
  {"copy", (PyCFunction)__pyx_pw_7_pynini_14PdtParentheses_8copy, METH_NOARGS, __pyx_doc_7_pynini_14PdtParentheses_7copy},
  {"add_pair", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_14PdtParentheses_10add_pair, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_14PdtParentheses_9add_pair},
  {"read", (PyCFunction)__pyx_pw_7_pynini_14PdtParentheses_12read, METH_O, __pyx_doc_7_pynini_14PdtParentheses_11read},
  {"write", (PyCFunction)__pyx_pw_7_pynini_14PdtParentheses_14write, METH_O, __pyx_doc_7_pynini_14PdtParentheses_13write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7_pynini_14PdtParentheses_16__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7_pynini_14PdtParentheses_18__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_PdtParentheses = {
  __pyx_pw_7_pynini_14PdtParentheses_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PdtParentheses = {
  __pyx_pw_7_pynini_14PdtParentheses_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7_pynini_PdtParentheses = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.PdtParentheses", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini_PdtParentheses), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini_PdtParentheses, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7_pynini_14PdtParentheses_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_PdtParentheses, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PdtParentheses, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n  PdtParentheses()\n\n  Pushdown transducer parentheses class.\n\n  This class wraps a vector of pairs of arc labels in which the first label is\n  interpreted as a \"push\" stack operation and the second represents the\n  corresponding \"pop\" operation. When efficiency is desired, the push and pop\n  indices should be contiguous.\n\n  A PDT is expressed as an (Fst, PdtParentheses) pair for the purposes of all\n  supported PDT operations.\n  ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7_pynini_14PdtParentheses_5__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7_pynini_PdtParentheses, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini_PdtParentheses, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_7_pynini_MPdtParentheses __pyx_vtable_7_pynini_MPdtParentheses;

static PyObject *__pyx_tp_new_7_pynini_MPdtParentheses(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7_pynini_MPdtParentheses *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini_MPdtParentheses *)o);
  p->__pyx_vtab = __pyx_vtabptr_7_pynini_MPdtParentheses;
  new((void*)&(p->_parens)) std::vector<std::pair<int64_t,int64_t> > ();
  new((void*)&(p->_assign)) std::vector<int64_t> ();
  return o;
}

static void __pyx_tp_dealloc_7_pynini_MPdtParentheses(PyObject *o) {
  struct __pyx_obj_7_pynini_MPdtParentheses *p = (struct __pyx_obj_7_pynini_MPdtParentheses *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->_parens);
  __Pyx_call_destructor(p->_assign);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7_pynini_MPdtParentheses[] = {
  {"copy", (PyCFunction)__pyx_pw_7_pynini_15MPdtParentheses_8copy, METH_NOARGS, __pyx_doc_7_pynini_15MPdtParentheses_7copy},
  {"add_triple", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_15MPdtParentheses_10add_triple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_15MPdtParentheses_9add_triple},
  {"read", (PyCFunction)__pyx_pw_7_pynini_15MPdtParentheses_12read, METH_O, __pyx_doc_7_pynini_15MPdtParentheses_11read},
  {"write", (PyCFunction)__pyx_pw_7_pynini_15MPdtParentheses_14write, METH_O, __pyx_doc_7_pynini_15MPdtParentheses_13write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7_pynini_15MPdtParentheses_16__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7_pynini_15MPdtParentheses_18__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_MPdtParentheses = {
  __pyx_pw_7_pynini_15MPdtParentheses_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_MPdtParentheses = {
  __pyx_pw_7_pynini_15MPdtParentheses_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7_pynini_MPdtParentheses = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.MPdtParentheses", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini_MPdtParentheses), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini_MPdtParentheses, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7_pynini_15MPdtParentheses_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_MPdtParentheses, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MPdtParentheses, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n  MPdtParentheses()\n\n  Multi-pushdown transducer parentheses class.\n\n  This class wraps a vector of pairs of arc labels in which the first label is\n  interpreted as a \"push\" stack operation and the second represents the\n  corresponding \"pop\" operation, and an equally sized vector which assigns each\n  pair to a stack. The library currently only permits two stacks (numbered 1\n  and 2) to be used.\n\n  A MPDT is expressed as an (Fst, MPdtParentheses) pair for the purposes of all\n  supported MPDT operations.\n  ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7_pynini_15MPdtParentheses_5__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7_pynini_MPdtParentheses, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini_MPdtParentheses, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_7_pynini__StringPathIterator __pyx_vtable_7_pynini__StringPathIterator;

static PyObject *__pyx_tp_new_7_pynini__StringPathIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7_pynini__StringPathIterator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini__StringPathIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_7_pynini__StringPathIterator;
  new((void*)&(p->_paths)) std::unique_ptr<fst::script::StringPathIteratorClass> ();
  return o;
}

static void __pyx_tp_dealloc_7_pynini__StringPathIterator(PyObject *o) {
  struct __pyx_obj_7_pynini__StringPathIterator *p = (struct __pyx_obj_7_pynini__StringPathIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->_paths);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7_pynini__StringPathIterator[] = {
  {"done", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_5done, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_4done},
  {"error", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_7error, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_6error},
  {"ilabels", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_9ilabels, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_8ilabels},
  {"olabels", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_11olabels, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_10olabels},
  {"istring", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_13istring, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_12istring},
  {"istrings", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_15istrings, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_14istrings},
  {"items", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_18items, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_17items},
  {"next", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_21next, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_20next},
  {"reset", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_23reset, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_22reset},
  {"ostring", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_25ostring, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_24ostring},
  {"ostrings", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_27ostrings, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_26ostrings},
  {"weight", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_30weight, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_29weight},
  {"weights", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_32weights, METH_NOARGS, __pyx_doc_7_pynini_19_StringPathIterator_31weights},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_35__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7_pynini_19_StringPathIterator_37__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7_pynini__StringPathIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini._StringPathIterator", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini__StringPathIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini__StringPathIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7_pynini_19_StringPathIterator_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n  _StringPathIterator(fst, input_token_type=None, output_token_type=None)\n\n  Iterator for string paths in acyclic FST.\n\n  This class provides an iterator over all paths (represented as pairs of\n  strings and an associated path weight) through an acyclic FST. This\n  operation is only feasible when the FST is acyclic. Depending on the\n  requested token type, the arc labels along the input and output sides of a\n  path are interpreted as UTF-8-encoded Unicode strings, raw bytes, or a\n  concatenation of string labels from a symbol table. This class is normally\n  created by invoking the `paths` method of `Fst`.\n\n  Args:\n    fst: input acyclic FST.\n    input_token_type: An optional string indicating how the input strings are\n        to be constructed from arc labels---one of: \"byte\" (interprets arc\n        labels as raw bytes), \"utf8\" (interprets arc labels as Unicode code\n        points), or a SymbolTable. If not set, or set to None, the value is set\n        to the default token_type, which begins as \"byte\", but can be overridden\n        for regions of code using the default_token_type context manager.\n    output_token_type: An optional string indicating how the output strings are\n        to be constructed from arc labels---one of: \"byte\" (interprets arc\n        labels as raw bytes), \"utf8\" (interprets arc labels as Unicode code\n        points), or a SymbolTable. If not set, or set to None, the value is set\n        to the default token_type, which begins as \"byte\", but can be overridden\n        for regions of code using the default_token_type context manager.\n\n  Raises:\n    FstArgError: Unknown token type.\n    FstOpError: Operation failed.\n  ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7_pynini__StringPathIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7_pynini_19_StringPathIterator_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini__StringPathIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_7_pynini_Far __pyx_vtable_7_pynini_Far;

static PyObject *__pyx_tp_new_7_pynini_Far(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7_pynini_Far *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7_pynini_Far *)o);
  p->__pyx_vtab = __pyx_vtabptr_7_pynini_Far;
  new((void*)&(p->_name)) std::string();
  p->_reader = ((struct __pyx_obj_10_pywrapfst_FarReader *)Py_None); Py_INCREF(Py_None);
  p->_writer = ((struct __pyx_obj_10_pywrapfst_FarWriter *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7_pynini_Far(PyObject *o) {
  struct __pyx_obj_7_pynini_Far *p = (struct __pyx_obj_7_pynini_Far *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_name);
  Py_CLEAR(p->_reader);
  Py_CLEAR(p->_writer);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7_pynini_Far(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini_Far *p = (struct __pyx_obj_7_pynini_Far *)o;
  if (p->_reader) {
    e = (*v)(((PyObject *)p->_reader), a); if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject *)p->_writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini_Far(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini_Far *p = (struct __pyx_obj_7_pynini_Far *)o;
  tmp = ((PyObject*)p->_reader);
  p->_reader = ((struct __pyx_obj_10_pywrapfst_FarReader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_writer);
  p->_writer = ((struct __pyx_obj_10_pywrapfst_FarWriter *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_7_pynini_Far(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_7_pynini_Far(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_7_pynini_3Far_37__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_specialmethod___pyx_pw_7_pynini_3Far_31__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_7_pynini_3Far_31__next__(self);}

static PyMethodDef __pyx_methods_7_pynini_Far[] = {
  {"error", (PyCFunction)__pyx_pw_7_pynini_3Far_5error, METH_NOARGS, __pyx_doc_7_pynini_3Far_4error},
  {"arc_type", (PyCFunction)__pyx_pw_7_pynini_3Far_7arc_type, METH_NOARGS, __pyx_doc_7_pynini_3Far_6arc_type},
  {"closed", (PyCFunction)__pyx_pw_7_pynini_3Far_9closed, METH_NOARGS, __pyx_doc_7_pynini_3Far_8closed},
  {"far_type", (PyCFunction)__pyx_pw_7_pynini_3Far_11far_type, METH_NOARGS, __pyx_doc_7_pynini_3Far_10far_type},
  {"mode", (PyCFunction)__pyx_pw_7_pynini_3Far_13mode, METH_NOARGS, __pyx_doc_7_pynini_3Far_12mode},
  {"name", (PyCFunction)__pyx_pw_7_pynini_3Far_15name, METH_NOARGS, __pyx_doc_7_pynini_3Far_14name},
  {"done", (PyCFunction)__pyx_pw_7_pynini_3Far_17done, METH_NOARGS, __pyx_doc_7_pynini_3Far_16done},
  {"find", (PyCFunction)__pyx_pw_7_pynini_3Far_19find, METH_O, __pyx_doc_7_pynini_3Far_18find},
  {"get_fst", (PyCFunction)__pyx_pw_7_pynini_3Far_21get_fst, METH_NOARGS, __pyx_doc_7_pynini_3Far_20get_fst},
  {"get_key", (PyCFunction)__pyx_pw_7_pynini_3Far_23get_key, METH_NOARGS, __pyx_doc_7_pynini_3Far_22get_key},
  {"next", (PyCFunction)__pyx_pw_7_pynini_3Far_25next, METH_NOARGS, __pyx_doc_7_pynini_3Far_24next},
  {"reset", (PyCFunction)__pyx_pw_7_pynini_3Far_27reset, METH_NOARGS, __pyx_doc_7_pynini_3Far_26reset},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_7_pynini_3Far_31__next__, METH_NOARGS|METH_COEXIST, 0},
  {"add", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Far_35add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_3Far_34add},
  {"close", (PyCFunction)__pyx_pw_7_pynini_3Far_39close, METH_NOARGS, __pyx_doc_7_pynini_3Far_38close},
  {"__enter__", (PyCFunction)__pyx_pw_7_pynini_3Far_41__enter__, METH_NOARGS, 0},
  {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_3Far_43__exit__, METH_VARARGS|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7_pynini_3Far_45__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7_pynini_3Far_47__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_Far = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7_pynini_Far, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Far = {
  0, /*mp_length*/
  __pyx_pw_7_pynini_3Far_29__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_7_pynini_Far, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7_pynini_Far = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.Far", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini_Far), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini_Far, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_7_pynini_3Far_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Far, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Far, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n  Far(filename, mode=\"r\", arc_type=\"standard\", far_type=\"default\")\n\n  Pynini FAR (\"Fst ARchive\") object.\n\n  This class is used to either read FSTs from or write FSTs to a FAR. When\n  opening a FAR for writing, the user may also specify the desired arc type\n  and FAR type.\n\n  Args:\n    filename: A string indicating the filename.\n    mode: FAR IO mode; one of: \"r\" (open for reading), \"w\" (open for writing).\n    arc_type: Desired arc type; ignored if the FAR is opened for reading.\n    far_type: Desired FAR type; ignored if the FAR is opened for reading.\n  ", /*tp_doc*/
  __pyx_tp_traverse_7_pynini_Far, /*tp_traverse*/
  __pyx_tp_clear_7_pynini_Far, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7_pynini_3Far_33__iter__, /*tp_iter*/
  __pyx_pw_7_pynini_3Far_31__next__, /*tp_iternext*/
  __pyx_methods_7_pynini_Far, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7_pynini_3Far_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini_Far, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct__union *__pyx_freelist_7_pynini___pyx_scope_struct__union[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct__union = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct__union(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct__union > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct__union)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct__union[--__pyx_freecount_7_pynini___pyx_scope_struct__union];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct__union));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct__union(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct__union *p = (struct __pyx_obj_7_pynini___pyx_scope_struct__union *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fsts2);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct__union < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct__union)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct__union[__pyx_freecount_7_pynini___pyx_scope_struct__union++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct__union *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct__union(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct__union *p = (struct __pyx_obj_7_pynini___pyx_scope_struct__union *)o;
  if (p->__pyx_v_fsts2) {
    e = (*v)(p->__pyx_v_fsts2, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct__union(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct__union *p = (struct __pyx_obj_7_pynini___pyx_scope_struct__union *)o;
  tmp = ((PyObject*)p->__pyx_v_fsts2);
  p->__pyx_v_fsts2 = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_7_pynini_Fst *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct__union = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct__union", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct__union), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct__union, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct__union, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct__union, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct__union, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *__pyx_freelist_7_pynini___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_1_genexpr[--__pyx_freecount_7_pynini___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_fst2);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_1_genexpr[__pyx_freecount_7_pynini___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_fst2) {
    e = (*v)(p->__pyx_v_fst2, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *__pyx_freelist_7_pynini___pyx_scope_struct_2__1arg_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_2__1arg_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_2__1arg_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_2__1arg_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_2__1arg_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_2__1arg_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_2__1arg_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_2__1arg_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_2__1arg_patch[__pyx_freecount_7_pynini___pyx_scope_struct_2__1arg_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_2__1arg_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_2__1arg_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_2__1arg_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_2__1arg_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_2__1arg_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_2__1arg_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_2__1arg_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_2__1arg_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *__pyx_freelist_7_pynini___pyx_scope_struct_3__shortestdistance_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_3__shortestdistance_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_3__shortestdistance_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_3__shortestdistance_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_3__shortestdistance_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_3__shortestdistance_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_3__shortestdistance_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_3__shortestdistance_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_3__shortestdistance_patch[__pyx_freecount_7_pynini___pyx_scope_struct_3__shortestdistance_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_3__shortestdistance_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_3__shortestdistance_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_3__shortestdistance_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_3__shortestdistance_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_3__shortestdistance_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_3__shortestdistance_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_3__shortestdistance_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_3__shortestdistance_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *__pyx_freelist_7_pynini___pyx_scope_struct_4__compose_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_4__compose_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_4__compose_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_4__compose_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_4__compose_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_4__compose_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_4__compose_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_4__compose_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_4__compose_patch[__pyx_freecount_7_pynini___pyx_scope_struct_4__compose_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_4__compose_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_4__compose_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_4__compose_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_4__compose_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_4__compose_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_4__compose_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_4__compose_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_4__compose_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_4__compose_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *__pyx_freelist_7_pynini___pyx_scope_struct_5__difference_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_5__difference_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_5__difference_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_5__difference_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_5__difference_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_5__difference_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_5__difference_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_5__difference_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_5__difference_patch[__pyx_freecount_7_pynini___pyx_scope_struct_5__difference_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_5__difference_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_5__difference_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_5__difference_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_5__difference_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_5__difference_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_5__difference_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_5__difference_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_5__difference_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_5__difference_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *__pyx_freelist_7_pynini___pyx_scope_struct_6__comp_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_6__comp_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_6__comp_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_6__comp_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_6__comp_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_6__comp_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_6__comp_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_6__comp_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_6__comp_patch[__pyx_freecount_7_pynini___pyx_scope_struct_6__comp_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_6__comp_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_6__comp_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_6__comp_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_6__comp_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_6__comp_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_6__comp_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_6__comp_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_6__comp_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_6__comp_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *__pyx_freelist_7_pynini___pyx_scope_struct_7___iter__[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_7___iter__ = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_7___iter__[--__pyx_freecount_7_pynini___pyx_scope_struct_7___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_7___iter__(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_7___iter__[__pyx_freecount_7_pynini___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_7___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_7___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_7___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_7___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_7___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_7___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *__pyx_freelist_7_pynini___pyx_scope_struct_8___iter__[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_8___iter__ = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_8___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_8___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_8___iter__[--__pyx_freecount_7_pynini___pyx_scope_struct_8___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_8___iter__(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_8___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_8___iter__[__pyx_freecount_7_pynini___pyx_scope_struct_8___iter__++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_8___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_8___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_8___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_8___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_8___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_8___iter__, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_8___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *__pyx_freelist_7_pynini___pyx_scope_struct_9_istrings[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_9_istrings = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_9_istrings(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_9_istrings > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_9_istrings[--__pyx_freecount_7_pynini___pyx_scope_struct_9_istrings];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_9_istrings(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_9_istrings < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_9_istrings[__pyx_freecount_7_pynini___pyx_scope_struct_9_istrings++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_9_istrings(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_9_istrings = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_9_istrings", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_9_istrings), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_9_istrings, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_9_istrings, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_9_istrings, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *__pyx_freelist_7_pynini___pyx_scope_struct_10_items[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_10_items = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_10_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_10_items > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_10_items)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_10_items[--__pyx_freecount_7_pynini___pyx_scope_struct_10_items];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_10_items));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_10_items(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_10_items < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_10_items)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_10_items[__pyx_freecount_7_pynini___pyx_scope_struct_10_items++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_10_items(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_10_items *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_10_items = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_10_items", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_10_items), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_10_items, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_10_items, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_10_items, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *__pyx_freelist_7_pynini___pyx_scope_struct_11_ostrings[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_11_ostrings = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_11_ostrings(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_11_ostrings > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_11_ostrings[--__pyx_freecount_7_pynini___pyx_scope_struct_11_ostrings];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_11_ostrings(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_11_ostrings < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_11_ostrings[__pyx_freecount_7_pynini___pyx_scope_struct_11_ostrings++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_11_ostrings(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_11_ostrings = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_11_ostrings", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_11_ostrings), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_11_ostrings, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_11_ostrings, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_11_ostrings, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *__pyx_freelist_7_pynini___pyx_scope_struct_12_weights[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_12_weights = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_12_weights(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_12_weights > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_12_weights[--__pyx_freecount_7_pynini___pyx_scope_struct_12_weights];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_12_weights(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_12_weights < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_12_weights[__pyx_freecount_7_pynini___pyx_scope_struct_12_weights++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_12_weights(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_12_weights = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_12_weights", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_12_weights), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_12_weights, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_12_weights, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_12_weights, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *__pyx_freelist_7_pynini___pyx_scope_struct_13__copy_patch[8];
static int __pyx_freecount_7_pynini___pyx_scope_struct_13__copy_patch = 0;

static PyObject *__pyx_tp_new_7_pynini___pyx_scope_struct_13__copy_patch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7_pynini___pyx_scope_struct_13__copy_patch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch)))) {
    o = (PyObject*)__pyx_freelist_7_pynini___pyx_scope_struct_13__copy_patch[--__pyx_freecount_7_pynini___pyx_scope_struct_13__copy_patch];
    memset(o, 0, sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7_pynini___pyx_scope_struct_13__copy_patch(PyObject *o) {
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fnc);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7_pynini___pyx_scope_struct_13__copy_patch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch)))) {
    __pyx_freelist_7_pynini___pyx_scope_struct_13__copy_patch[__pyx_freecount_7_pynini___pyx_scope_struct_13__copy_patch++] = ((struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7_pynini___pyx_scope_struct_13__copy_patch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)o;
  if (p->__pyx_v_fnc) {
    e = (*v)(p->__pyx_v_fnc, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7_pynini___pyx_scope_struct_13__copy_patch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *p = (struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch *)o;
  tmp = ((PyObject*)p->__pyx_v_fnc);
  p->__pyx_v_fnc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7_pynini___pyx_scope_struct_13__copy_patch = {
  PyVarObject_HEAD_INIT(0, 0)
  "_pynini.__pyx_scope_struct_13__copy_patch", /*tp_name*/
  sizeof(struct __pyx_obj_7_pynini___pyx_scope_struct_13__copy_patch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7_pynini___pyx_scope_struct_13__copy_patch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7_pynini___pyx_scope_struct_13__copy_patch, /*tp_traverse*/
  __pyx_tp_clear_7_pynini___pyx_scope_struct_13__copy_patch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7_pynini___pyx_scope_struct_13__copy_patch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"_from_pywrapfst", (PyCFunction)__pyx_pw_7_pynini_1_from_pywrapfst, METH_O, 0},
  {"_read", (PyCFunction)__pyx_pw_7_pynini_3_read, METH_O, 0},
  {"_read_from_string", (PyCFunction)__pyx_pw_7_pynini_5_read_from_string, METH_O, 0},
  {"escape", (PyCFunction)__pyx_pw_7_pynini_7escape, METH_O, __pyx_doc_7_pynini_6escape},
  {"accep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_9accep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_8accep},
  {"cross", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_11cross, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_10cross},
  {"cdrewrite", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_13cdrewrite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_12cdrewrite},
  {"leniently_compose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_15leniently_compose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_14leniently_compose},
  {"string_file", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_17string_file, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_16string_file},
  {"string_map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_19string_map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_18string_map},
  {"generated_symbols", (PyCFunction)__pyx_pw_7_pynini_21generated_symbols, METH_NOARGS, __pyx_doc_7_pynini_20generated_symbols},
  {"concat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_33concat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_32concat},
  {"replace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_35replace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_34replace},
  {"pdt_reverse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_45pdt_reverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_44pdt_reverse},
  {"pdt_shortestpath", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_47pdt_shortestpath, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_46pdt_shortestpath},
  {"mpdt_compose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_49mpdt_compose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_48mpdt_compose},
  {"mpdt_expand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7_pynini_51mpdt_expand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7_pynini_50mpdt_expand},
  {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__pynini(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__pynini},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_pynini",
    __pyx_k_Pynini_finite_state_grammar_comp, /* 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_n_s_1arg_patch, __pyx_k_1arg_patch, sizeof(__pyx_k_1arg_patch), 0, 0, 1, 1},
  {&__pyx_n_s_1arg_patch_locals_patch, __pyx_k_1arg_patch_locals_patch, sizeof(__pyx_k_1arg_patch_locals_patch), 0, 0, 1, 1},
  {&__pyx_n_s_ACCEPTOR, __pyx_k_ACCEPTOR, sizeof(__pyx_k_ACCEPTOR), 0, 0, 1, 1},
  {&__pyx_n_s_ACCESSIBLE, __pyx_k_ACCESSIBLE, sizeof(__pyx_k_ACCESSIBLE), 0, 0, 1, 1},
  {&__pyx_n_s_ACYCLIC, __pyx_k_ACYCLIC, sizeof(__pyx_k_ACYCLIC), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_ARC_PROPERTIES, __pyx_k_ADD_ARC_PROPERTIES, sizeof(__pyx_k_ADD_ARC_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_STATE_PROPERTIES, __pyx_k_ADD_STATE_PROPERTIES, sizeof(__pyx_k_ADD_STATE_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_SUPERFINAL_PROPERTIES, __pyx_k_ADD_SUPERFINAL_PROPERTIES, sizeof(__pyx_k_ADD_SUPERFINAL_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_FLAGS, __pyx_k_ARC_FLAGS, sizeof(__pyx_k_ARC_FLAGS), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_I_LABEL_VALUE, __pyx_k_ARC_I_LABEL_VALUE, sizeof(__pyx_k_ARC_I_LABEL_VALUE), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_NEXT_STATE_VALUE, __pyx_k_ARC_NEXT_STATE_VALUE, sizeof(__pyx_k_ARC_NEXT_STATE_VALUE), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_NO_CACHE, __pyx_k_ARC_NO_CACHE, sizeof(__pyx_k_ARC_NO_CACHE), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_O_LABEL_VALUE, __pyx_k_ARC_O_LABEL_VALUE, sizeof(__pyx_k_ARC_O_LABEL_VALUE), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_SORT_PROPERTIES, __pyx_k_ARC_SORT_PROPERTIES, sizeof(__pyx_k_ARC_SORT_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_VALUE_FLAGS, __pyx_k_ARC_VALUE_FLAGS, sizeof(__pyx_k_ARC_VALUE_FLAGS), 0, 0, 1, 1},
  {&__pyx_n_s_ARC_WEIGHT_VALUE, __pyx_k_ARC_WEIGHT_VALUE, sizeof(__pyx_k_ARC_WEIGHT_VALUE), 0, 0, 1, 1},
  {&__pyx_n_s_Arc, __pyx_k_Arc, sizeof(__pyx_k_Arc), 0, 0, 1, 1},
  {&__pyx_n_s_ArcIterator, __pyx_k_ArcIterator, sizeof(__pyx_k_ArcIterator), 0, 0, 1, 1},
  {&__pyx_n_s_ArcMapType, __pyx_k_ArcMapType, sizeof(__pyx_k_ArcMapType), 0, 0, 1, 1},
  {&__pyx_n_s_BINARY_PROPERTIES, __pyx_k_BINARY_PROPERTIES, sizeof(__pyx_k_BINARY_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_CDRewriteDirection, __pyx_k_CDRewriteDirection, sizeof(__pyx_k_CDRewriteDirection), 0, 0, 1, 1},
  {&__pyx_n_s_CDRewriteMode, __pyx_k_CDRewriteMode, sizeof(__pyx_k_CDRewriteMode), 0, 0, 1, 1},
  {&__pyx_n_s_COACCESSIBLE, __pyx_k_COACCESSIBLE, sizeof(__pyx_k_COACCESSIBLE), 0, 0, 1, 1},
  {&__pyx_n_s_COPY_PROPERTIES, __pyx_k_COPY_PROPERTIES, sizeof(__pyx_k_COPY_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_CYCLIC, __pyx_k_CYCLIC, sizeof(__pyx_k_CYCLIC), 0, 0, 1, 1},
  {&__pyx_n_s_ComposeFilter, __pyx_k_ComposeFilter, sizeof(__pyx_k_ComposeFilter), 0, 0, 1, 1},
  {&__pyx_n_s_ContextDecorator, __pyx_k_ContextDecorator, sizeof(__pyx_k_ContextDecorator), 0, 0, 1, 1},
  {&__pyx_n_s_DELETE_ARC_PROPERTIES, __pyx_k_DELETE_ARC_PROPERTIES, sizeof(__pyx_k_DELETE_ARC_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_DELETE_STATE_PROPERTIES, __pyx_k_DELETE_STATE_PROPERTIES, sizeof(__pyx_k_DELETE_STATE_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_DeterminizeType, __pyx_k_DeterminizeType, sizeof(__pyx_k_DeterminizeType), 0, 0, 1, 1},
  {&__pyx_n_s_ENCODE_FLAGS, __pyx_k_ENCODE_FLAGS, sizeof(__pyx_k_ENCODE_FLAGS), 0, 0, 1, 1},
  {&__pyx_n_s_ENCODE_LABELS, __pyx_k_ENCODE_LABELS, sizeof(__pyx_k_ENCODE_LABELS), 0, 0, 1, 1},
  {&__pyx_n_s_ENCODE_WEIGHTS, __pyx_k_ENCODE_WEIGHTS, sizeof(__pyx_k_ENCODE_WEIGHTS), 0, 0, 1, 1},
  {&__pyx_n_s_EPSILONS, __pyx_k_EPSILONS, sizeof(__pyx_k_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1},
  {&__pyx_n_s_EXPANDED, __pyx_k_EXPANDED, sizeof(__pyx_k_EXPANDED), 0, 0, 1, 1},
  {&__pyx_n_s_EXTRINSIC_PROPERTIES, __pyx_k_EXTRINSIC_PROPERTIES, sizeof(__pyx_k_EXTRINSIC_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__pyx_n_s_EncodeMapper, __pyx_k_EncodeMapper, sizeof(__pyx_k_EncodeMapper), 0, 0, 1, 1},
  {&__pyx_n_s_EpsNormalizeType, __pyx_k_EpsNormalizeType, sizeof(__pyx_k_EpsNormalizeType), 0, 0, 1, 1},
  {&__pyx_kp_u_Expected_tuple_of_length_two, __pyx_k_Expected_tuple_of_length_two, sizeof(__pyx_k_Expected_tuple_of_length_two), 0, 1, 0, 0},
  {&__pyx_n_s_FST_PROPERTIES, __pyx_k_FST_PROPERTIES, sizeof(__pyx_k_FST_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_kp_u_Far, __pyx_k_Far, sizeof(__pyx_k_Far), 0, 1, 0, 0},
  {&__pyx_n_s_FarFileMode, __pyx_k_FarFileMode, sizeof(__pyx_k_FarFileMode), 0, 0, 1, 1},
  {&__pyx_n_s_FarType, __pyx_k_FarType, sizeof(__pyx_k_FarType), 0, 0, 1, 1},
  {&__pyx_n_s_Far_2, __pyx_k_Far_2, sizeof(__pyx_k_Far_2), 0, 0, 1, 1},
  {&__pyx_n_s_Fst, __pyx_k_Fst, sizeof(__pyx_k_Fst), 0, 0, 1, 1},
  {&__pyx_n_s_FstArgError, __pyx_k_FstArgError, sizeof(__pyx_k_FstArgError), 0, 0, 1, 1},
  {&__pyx_n_s_FstBadWeightError, __pyx_k_FstBadWeightError, sizeof(__pyx_k_FstBadWeightError), 0, 0, 1, 1},
  {&__pyx_n_s_FstIOError, __pyx_k_FstIOError, sizeof(__pyx_k_FstIOError), 0, 0, 1, 1},
  {&__pyx_n_s_FstIndexError, __pyx_k_FstIndexError, sizeof(__pyx_k_FstIndexError), 0, 0, 1, 1},
  {&__pyx_n_s_FstLike, __pyx_k_FstLike, sizeof(__pyx_k_FstLike), 0, 0, 1, 1},
  {&__pyx_n_s_FstOpError, __pyx_k_FstOpError, sizeof(__pyx_k_FstOpError), 0, 0, 1, 1},
  {&__pyx_n_s_FstProperties, __pyx_k_FstProperties, sizeof(__pyx_k_FstProperties), 0, 0, 1, 1},
  {&__pyx_n_s_FstStringCompilationError, __pyx_k_FstStringCompilationError, sizeof(__pyx_k_FstStringCompilationError), 0, 0, 1, 1},
  {&__pyx_n_s_INITIAL_ACYCLIC, __pyx_k_INITIAL_ACYCLIC, sizeof(__pyx_k_INITIAL_ACYCLIC), 0, 0, 1, 1},
  {&__pyx_n_s_INITIAL_CYCLIC, __pyx_k_INITIAL_CYCLIC, sizeof(__pyx_k_INITIAL_CYCLIC), 0, 0, 1, 1},
  {&__pyx_n_s_INTRINSIC_PROPERTIES, __pyx_k_INTRINSIC_PROPERTIES, sizeof(__pyx_k_INTRINSIC_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_I_DETERMINISTIC, __pyx_k_I_DETERMINISTIC, sizeof(__pyx_k_I_DETERMINISTIC), 0, 0, 1, 1},
  {&__pyx_n_s_I_EPSILONS, __pyx_k_I_EPSILONS, sizeof(__pyx_k_I_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES, __pyx_k_I_LABEL_INVARIANT_PROPERTIES, sizeof(__pyx_k_I_LABEL_INVARIANT_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_I_LABEL_SORTED, __pyx_k_I_LABEL_SORTED, sizeof(__pyx_k_I_LABEL_SORTED), 0, 0, 1, 1},
  {&__pyx_kp_u_I_O_operation_on_closed_FAR, __pyx_k_I_O_operation_on_closed_FAR, sizeof(__pyx_k_I_O_operation_on_closed_FAR), 0, 1, 0, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x07, __pyx_k_Incompatible_checksums_s_vs_0x07, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x07), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x79, __pyx_k_Incompatible_checksums_s_vs_0x79, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x79), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xcb, __pyx_k_Incompatible_checksums_s_vs_0xcb, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xcb), 0, 0, 1, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_MPdtParentheses, __pyx_k_MPdtParentheses, sizeof(__pyx_k_MPdtParentheses), 0, 0, 1, 1},
  {&__pyx_n_s_MPdtParentheses___iter, __pyx_k_MPdtParentheses___iter, sizeof(__pyx_k_MPdtParentheses___iter), 0, 0, 1, 1},
  {&__pyx_n_s_MUTABLE, __pyx_k_MUTABLE, sizeof(__pyx_k_MUTABLE), 0, 0, 1, 1},
  {&__pyx_n_s_MutableArcIterator, __pyx_k_MutableArcIterator, sizeof(__pyx_k_MutableArcIterator), 0, 0, 1, 1},
  {&__pyx_n_s_NEG_TRINARY_PROPERTIES, __pyx_k_NEG_TRINARY_PROPERTIES, sizeof(__pyx_k_NEG_TRINARY_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_NON_I_DETERMINISTIC, __pyx_k_NON_I_DETERMINISTIC, sizeof(__pyx_k_NON_I_DETERMINISTIC), 0, 0, 1, 1},
  {&__pyx_n_s_NON_O_DETERMINISTIC, __pyx_k_NON_O_DETERMINISTIC, sizeof(__pyx_k_NON_O_DETERMINISTIC), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_ACCEPTOR, __pyx_k_NOT_ACCEPTOR, sizeof(__pyx_k_NOT_ACCEPTOR), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_ACCESSIBLE, __pyx_k_NOT_ACCESSIBLE, sizeof(__pyx_k_NOT_ACCESSIBLE), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_COACCESSIBLE, __pyx_k_NOT_COACCESSIBLE, sizeof(__pyx_k_NOT_COACCESSIBLE), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_I_LABEL_SORTED, __pyx_k_NOT_I_LABEL_SORTED, sizeof(__pyx_k_NOT_I_LABEL_SORTED), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_O_LABEL_SORTED, __pyx_k_NOT_O_LABEL_SORTED, sizeof(__pyx_k_NOT_O_LABEL_SORTED), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_STRING, __pyx_k_NOT_STRING, sizeof(__pyx_k_NOT_STRING), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_TOP_SORTED, __pyx_k_NOT_TOP_SORTED, sizeof(__pyx_k_NOT_TOP_SORTED), 0, 0, 1, 1},
  {&__pyx_n_s_NO_EPSILONS, __pyx_k_NO_EPSILONS, sizeof(__pyx_k_NO_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_NO_I_EPSILONS, __pyx_k_NO_I_EPSILONS, sizeof(__pyx_k_NO_I_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_NO_LABEL, __pyx_k_NO_LABEL, sizeof(__pyx_k_NO_LABEL), 0, 0, 1, 1},
  {&__pyx_n_s_NO_O_EPSILONS, __pyx_k_NO_O_EPSILONS, sizeof(__pyx_k_NO_O_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_NO_STATE_ID, __pyx_k_NO_STATE_ID, sizeof(__pyx_k_NO_STATE_ID), 0, 0, 1, 1},
  {&__pyx_n_s_NO_SYMBOL, __pyx_k_NO_SYMBOL, sizeof(__pyx_k_NO_SYMBOL), 0, 0, 1, 1},
  {&__pyx_n_s_NULL_PROPERTIES, __pyx_k_NULL_PROPERTIES, sizeof(__pyx_k_NULL_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_O_DETERMINISTIC, __pyx_k_O_DETERMINISTIC, sizeof(__pyx_k_O_DETERMINISTIC), 0, 0, 1, 1},
  {&__pyx_n_s_O_EPSILONS, __pyx_k_O_EPSILONS, sizeof(__pyx_k_O_EPSILONS), 0, 0, 1, 1},
  {&__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES, __pyx_k_O_LABEL_INVARIANT_PROPERTIES, sizeof(__pyx_k_O_LABEL_INVARIANT_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_O_LABEL_SORTED, __pyx_k_O_LABEL_SORTED, sizeof(__pyx_k_O_LABEL_SORTED), 0, 0, 1, 1},
  {&__pyx_kp_u_Operation_failed, __pyx_k_Operation_failed, sizeof(__pyx_k_Operation_failed), 0, 1, 0, 0},
  {&__pyx_kp_s_Override_the_default_token_type, __pyx_k_Override_the_default_token_type, sizeof(__pyx_k_Override_the_default_token_type), 0, 0, 1, 0},
  {&__pyx_n_s_POS_TRINARY_PROPERTIES, __pyx_k_POS_TRINARY_PROPERTIES, sizeof(__pyx_k_POS_TRINARY_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_PdtParentheses, __pyx_k_PdtParentheses, sizeof(__pyx_k_PdtParentheses), 0, 0, 1, 1},
  {&__pyx_n_s_PdtParentheses___iter, __pyx_k_PdtParentheses___iter, sizeof(__pyx_k_PdtParentheses___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_PointerSymbolTableView, __pyx_k_PointerSymbolTableView, sizeof(__pyx_k_PointerSymbolTableView), 0, 0, 1, 1},
  {&__pyx_n_s_ProjectType, __pyx_k_ProjectType, sizeof(__pyx_k_ProjectType), 0, 0, 1, 1},
  {&__pyx_n_s_QueueType, __pyx_k_QueueType, sizeof(__pyx_k_QueueType), 0, 0, 1, 1},
  {&__pyx_n_s_RM_SUPERFINAL_PROPERTIES, __pyx_k_RM_SUPERFINAL_PROPERTIES, sizeof(__pyx_k_RM_SUPERFINAL_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_RandArcSelection, __pyx_k_RandArcSelection, sizeof(__pyx_k_RandArcSelection), 0, 0, 1, 1},
  {&__pyx_kp_u_Read_failed, __pyx_k_Read_failed, sizeof(__pyx_k_Read_failed), 0, 1, 0, 0},
  {&__pyx_kp_u_Read_failed_2, __pyx_k_Read_failed_2, sizeof(__pyx_k_Read_failed_2), 0, 1, 0, 0},
  {&__pyx_n_s_ReplaceLabelType, __pyx_k_ReplaceLabelType, sizeof(__pyx_k_ReplaceLabelType), 0, 0, 1, 1},
  {&__pyx_n_s_ReweightType, __pyx_k_ReweightType, sizeof(__pyx_k_ReweightType), 0, 0, 1, 1},
  {&__pyx_n_s_SET_ARC_PROPERTIES, __pyx_k_SET_ARC_PROPERTIES, sizeof(__pyx_k_SET_ARC_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_SET_FINAL_PROPERTIES, __pyx_k_SET_FINAL_PROPERTIES, sizeof(__pyx_k_SET_FINAL_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_SET_START_PROPERTIES, __pyx_k_SET_START_PROPERTIES, sizeof(__pyx_k_SET_START_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_STATE_SORT_PROPERTIES, __pyx_k_STATE_SORT_PROPERTIES, sizeof(__pyx_k_STATE_SORT_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 0, 1, 1},
  {&__pyx_n_s_SortType, __pyx_k_SortType, sizeof(__pyx_k_SortType), 0, 0, 1, 1},
  {&__pyx_n_s_StateIterator, __pyx_k_StateIterator, sizeof(__pyx_k_StateIterator), 0, 0, 1, 1},
  {&__pyx_n_s_StateMapType, __pyx_k_StateMapType, sizeof(__pyx_k_StateMapType), 0, 0, 1, 1},
  {&__pyx_n_s_StringPathIterator, __pyx_k_StringPathIterator, sizeof(__pyx_k_StringPathIterator), 0, 0, 1, 1},
  {&__pyx_n_s_StringPathIterator_istrings, __pyx_k_StringPathIterator_istrings, sizeof(__pyx_k_StringPathIterator_istrings), 0, 0, 1, 1},
  {&__pyx_n_s_StringPathIterator_items, __pyx_k_StringPathIterator_items, sizeof(__pyx_k_StringPathIterator_items), 0, 0, 1, 1},
  {&__pyx_n_s_StringPathIterator_ostrings, __pyx_k_StringPathIterator_ostrings, sizeof(__pyx_k_StringPathIterator_ostrings), 0, 0, 1, 1},
  {&__pyx_n_s_StringPathIterator_weights, __pyx_k_StringPathIterator_weights, sizeof(__pyx_k_StringPathIterator_weights), 0, 0, 1, 1},
  {&__pyx_kp_u_String_compilation_failed, __pyx_k_String_compilation_failed, sizeof(__pyx_k_String_compilation_failed), 0, 1, 0, 0},
  {&__pyx_kp_u_String_map_compilation_failed, __pyx_k_String_map_compilation_failed, sizeof(__pyx_k_String_map_compilation_failed), 0, 1, 0, 0},
  {&__pyx_n_s_SymbolTable, __pyx_k_SymbolTable, sizeof(__pyx_k_SymbolTable), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolTableView, __pyx_k_SymbolTableView, sizeof(__pyx_k_SymbolTableView), 0, 0, 1, 1},
  {&__pyx_n_s_TOP_SORTED, __pyx_k_TOP_SORTED, sizeof(__pyx_k_TOP_SORTED), 0, 0, 1, 1},
  {&__pyx_n_s_TRINARY_PROPERTIES, __pyx_k_TRINARY_PROPERTIES, sizeof(__pyx_k_TRINARY_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_kp_u_The_lower_bound_must_be_an_integ, __pyx_k_The_lower_bound_must_be_an_integ, sizeof(__pyx_k_The_lower_bound_must_be_an_integ), 0, 1, 0, 0},
  {&__pyx_n_s_TokenType, __pyx_k_TokenType, sizeof(__pyx_k_TokenType), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UNWEIGHTED, __pyx_k_UNWEIGHTED, sizeof(__pyx_k_UNWEIGHTED), 0, 0, 1, 1},
  {&__pyx_n_s_UNWEIGHTED_CYCLES, __pyx_k_UNWEIGHTED_CYCLES, sizeof(__pyx_k_UNWEIGHTED_CYCLES), 0, 0, 1, 1},
  {&__pyx_kp_u_Unknown_PDT_compose_filter_type, __pyx_k_Unknown_PDT_compose_filter_type, sizeof(__pyx_k_Unknown_PDT_compose_filter_type), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_PDT_parser_type, __pyx_k_Unknown_PDT_parser_type, sizeof(__pyx_k_Unknown_PDT_parser_type), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_arc_type, __pyx_k_Unknown_arc_type, sizeof(__pyx_k_Unknown_arc_type), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_context_dependent_rewrit, __pyx_k_Unknown_context_dependent_rewrit, sizeof(__pyx_k_Unknown_context_dependent_rewrit), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_context_dependent_rewrit_2, __pyx_k_Unknown_context_dependent_rewrit_2, sizeof(__pyx_k_Unknown_context_dependent_rewrit_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_mode, __pyx_k_Unknown_mode, sizeof(__pyx_k_Unknown_mode), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_token_type, __pyx_k_Unknown_token_type, sizeof(__pyx_k_Unknown_token_type), 0, 1, 0, 0},
  {&__pyx_n_s_UnsupportedOperation, __pyx_k_UnsupportedOperation, sizeof(__pyx_k_UnsupportedOperation), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_WEIGHTED, __pyx_k_WEIGHTED, sizeof(__pyx_k_WEIGHTED), 0, 0, 1, 1},
  {&__pyx_n_s_WEIGHTED_CYCLES, __pyx_k_WEIGHTED_CYCLES, sizeof(__pyx_k_WEIGHTED_CYCLES), 0, 0, 1, 1},
  {&__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES, __pyx_k_WEIGHT_INVARIANT_PROPERTIES, sizeof(__pyx_k_WEIGHT_INVARIANT_PROPERTIES), 0, 0, 1, 1},
  {&__pyx_n_s_Weight, __pyx_k_Weight, sizeof(__pyx_k_Weight), 0, 0, 1, 1},
  {&__pyx_n_s_WeightLike, __pyx_k_WeightLike, sizeof(__pyx_k_WeightLike), 0, 0, 1, 1},
  {&__pyx_kp_u_Write_failed, __pyx_k_Write_failed, sizeof(__pyx_k_Write_failed), 0, 1, 0, 0},
  {&__pyx_kp_u__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 1, 0, 0},
  {&__pyx_kp_u__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0, 0},
  {&__pyx_kp_u__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 1, 0, 0},
  {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  {&__pyx_n_s_accep, __pyx_k_accep, sizeof(__pyx_k_accep), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_pair, __pyx_k_add_pair, sizeof(__pyx_k_add_pair), 0, 0, 1, 1},
  {&__pyx_n_s_add_triple, __pyx_k_add_triple, sizeof(__pyx_k_add_triple), 0, 0, 1, 1},
  {&__pyx_n_s_arc_type, __pyx_k_arc_type, sizeof(__pyx_k_arc_type), 0, 0, 1, 1},
  {&__pyx_n_s_arcmap, __pyx_k_arcmap, sizeof(__pyx_k_arcmap), 0, 0, 1, 1},
  {&__pyx_n_s_arcsort, __pyx_k_arcsort, sizeof(__pyx_k_arcsort), 0, 0, 1, 1},
  {&__pyx_n_s_arg1, __pyx_k_arg1, sizeof(__pyx_k_arg1), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_assignment, __pyx_k_assignment, sizeof(__pyx_k_assignment), 0, 0, 1, 1},
  {&__pyx_n_s_astring, __pyx_k_astring, sizeof(__pyx_k_astring), 0, 0, 1, 1},
  {&__pyx_kp_u_at_0x, __pyx_k_at_0x, sizeof(__pyx_k_at_0x), 0, 1, 0, 0},
  {&__pyx_kp_u_at_0x_2, __pyx_k_at_0x_2, sizeof(__pyx_k_at_0x_2), 0, 1, 0, 0},
  {&__pyx_n_u_auto, __pyx_k_auto, sizeof(__pyx_k_auto), 0, 1, 0, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_s_call_arc_labeling, __pyx_k_call_arc_labeling, sizeof(__pyx_k_call_arc_labeling), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1},
  {&__pyx_n_s_closure, __pyx_k_closure, sizeof(__pyx_k_closure), 0, 0, 1, 1},
  {&__pyx_n_s_comp_patch, __pyx_k_comp_patch, sizeof(__pyx_k_comp_patch), 0, 0, 1, 1},
  {&__pyx_n_s_comp_patch_locals_patch, __pyx_k_comp_patch_locals_patch, sizeof(__pyx_k_comp_patch_locals_patch), 0, 0, 1, 1},
  {&__pyx_n_s_compact_symbol_table, __pyx_k_compact_symbol_table, sizeof(__pyx_k_compact_symbol_table), 0, 0, 1, 1},
  {&__pyx_n_s_compose, __pyx_k_compose, sizeof(__pyx_k_compose), 0, 0, 1, 1},
  {&__pyx_n_s_compose_filter, __pyx_k_compose_filter, sizeof(__pyx_k_compose_filter), 0, 0, 1, 1},
  {&__pyx_n_s_compose_filter_2, __pyx_k_compose_filter_2, sizeof(__pyx_k_compose_filter_2), 0, 0, 1, 1},
  {&__pyx_n_s_compose_patch, __pyx_k_compose_patch, sizeof(__pyx_k_compose_patch), 0, 0, 1, 1},
  {&__pyx_n_s_compose_patch_locals_patch, __pyx_k_compose_patch_locals_patch, sizeof(__pyx_k_compose_patch_locals_patch), 0, 0, 1, 1},
  {&__pyx_n_s_compute_props, __pyx_k_compute_props, sizeof(__pyx_k_compute_props), 0, 0, 1, 1},
  {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1},
  {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1},
  {&__pyx_kp_u_const_pointer_SymbolTableView, __pyx_k_const_pointer_SymbolTableView, sizeof(__pyx_k_const_pointer_SymbolTableView), 0, 1, 0, 0},
  {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_copy_patch, __pyx_k_copy_patch, sizeof(__pyx_k_copy_patch), 0, 0, 1, 1},
  {&__pyx_n_s_copy_patch_locals_patch, __pyx_k_copy_patch_locals_patch, sizeof(__pyx_k_copy_patch_locals_patch), 0, 0, 1, 1},
  {&__pyx_n_s_create, __pyx_k_create, sizeof(__pyx_k_create), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_u_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 1, 0, 1},
  {&__pyx_n_s_default_token_type, __pyx_k_default_token_type, sizeof(__pyx_k_default_token_type), 0, 0, 1, 1},
  {&__pyx_n_s_default_token_type___enter, __pyx_k_default_token_type___enter, sizeof(__pyx_k_default_token_type___enter), 0, 0, 1, 1},
  {&__pyx_n_s_default_token_type___exit, __pyx_k_default_token_type___exit, sizeof(__pyx_k_default_token_type___exit), 0, 0, 1, 1},
  {&__pyx_n_s_default_token_type___init, __pyx_k_default_token_type___init, sizeof(__pyx_k_default_token_type___init), 0, 0, 1, 1},
  {&__pyx_n_s_determinize, __pyx_k_determinize, sizeof(__pyx_k_determinize), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_difference, __pyx_k_difference, sizeof(__pyx_k_difference), 0, 0, 1, 1},
  {&__pyx_n_s_difference_patch, __pyx_k_difference_patch, sizeof(__pyx_k_difference_patch), 0, 0, 1, 1},
  {&__pyx_n_s_difference_patch_locals_patch, __pyx_k_difference_patch_locals_patch, sizeof(__pyx_k_difference_patch_locals_patch), 0, 0, 1, 1},
  {&__pyx_n_s_direction, __pyx_k_direction, sizeof(__pyx_k_direction), 0, 0, 1, 1},
  {&__pyx_n_s_disambiguate, __pyx_k_disambiguate, sizeof(__pyx_k_disambiguate), 0, 0, 1, 1},
  {&__pyx_n_s_divide, __pyx_k_divide, sizeof(__pyx_k_divide), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_done, __pyx_k_done, sizeof(__pyx_k_done), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_epsilon_on_replace, __pyx_k_epsilon_on_replace, sizeof(__pyx_k_epsilon_on_replace), 0, 0, 1, 1},
  {&__pyx_n_s_epsnormalize, __pyx_k_epsnormalize, sizeof(__pyx_k_epsnormalize), 0, 0, 1, 1},
  {&__pyx_n_s_equal, __pyx_k_equal, sizeof(__pyx_k_equal), 0, 0, 1, 1},
  {&__pyx_n_s_equivalent, __pyx_k_equivalent, sizeof(__pyx_k_equivalent), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1},
  {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1},
  {&__pyx_n_s_exc_value, __pyx_k_exc_value, sizeof(__pyx_k_exc_value), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_kp_s_extensions__pynini_pyx, __pyx_k_extensions__pynini_pyx, sizeof(__pyx_k_extensions__pynini_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_far_type, __pyx_k_far_type, sizeof(__pyx_k_far_type), 0, 0, 1, 1},
  {&__pyx_n_u_fifo, __pyx_k_fifo, sizeof(__pyx_k_fifo), 0, 1, 0, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
  {&__pyx_n_s_fnc, __pyx_k_fnc, sizeof(__pyx_k_fnc), 0, 0, 1, 1},
  {&__pyx_n_s_from_pywrapfst, __pyx_k_from_pywrapfst, sizeof(__pyx_k_from_pywrapfst), 0, 0, 1, 1},
  {&__pyx_n_s_fst, __pyx_k_fst, sizeof(__pyx_k_fst), 0, 0, 1, 1},
  {&__pyx_n_s_fst1, __pyx_k_fst1, sizeof(__pyx_k_fst1), 0, 0, 1, 1},
  {&__pyx_n_s_fst1_2, __pyx_k_fst1_2, sizeof(__pyx_k_fst1_2), 0, 0, 1, 1},
  {&__pyx_n_s_fst2, __pyx_k_fst2, sizeof(__pyx_k_fst2), 0, 0, 1, 1},
  {&__pyx_n_s_fst2_2, __pyx_k_fst2_2, sizeof(__pyx_k_fst2_2), 0, 0, 1, 1},
  {&__pyx_n_s_fst_2, __pyx_k_fst_2, sizeof(__pyx_k_fst_2), 0, 0, 1, 1},
  {&__pyx_n_s_fsts, __pyx_k_fsts, sizeof(__pyx_k_fsts), 0, 0, 1, 1},
  {&__pyx_n_s_fsts2, __pyx_k_fsts2, sizeof(__pyx_k_fsts2), 0, 0, 1, 1},
  {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get_fst, __pyx_k_get_fst, sizeof(__pyx_k_get_fst), 0, 0, 1, 1},
  {&__pyx_n_s_get_key, __pyx_k_get_key, sizeof(__pyx_k_get_key), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_u_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 1, 0, 1},
  {&__pyx_n_s_input_token_type, __pyx_k_input_token_type, sizeof(__pyx_k_input_token_type), 0, 0, 1, 1},
  {&__pyx_n_s_intersect, __pyx_k_intersect, sizeof(__pyx_k_intersect), 0, 0, 1, 1},
  {&__pyx_n_s_invert, __pyx_k_invert, sizeof(__pyx_k_invert), 0, 0, 1, 1},
  {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
  {&__pyx_n_s_isomorphic, __pyx_k_isomorphic, sizeof(__pyx_k_isomorphic), 0, 0, 1, 1},
  {&__pyx_n_s_istring, __pyx_k_istring, sizeof(__pyx_k_istring), 0, 0, 1, 1},
  {&__pyx_n_s_istrings, __pyx_k_istrings, sizeof(__pyx_k_istrings), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_keep_parentheses, __pyx_k_keep_parentheses, sizeof(__pyx_k_keep_parentheses), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_label, __pyx_k_label, sizeof(__pyx_k_label), 0, 0, 1, 1},
  {&__pyx_n_u_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 1, 0, 1},
  {&__pyx_n_s_left_mpdt, __pyx_k_left_mpdt, sizeof(__pyx_k_left_mpdt), 0, 0, 1, 1},
  {&__pyx_n_s_left_paren_prefix, __pyx_k_left_paren_prefix, sizeof(__pyx_k_left_paren_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_left_pdt, __pyx_k_left_pdt, sizeof(__pyx_k_left_pdt), 0, 0, 1, 1},
  {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_u_ltr, __pyx_k_ltr, sizeof(__pyx_k_ltr), 0, 1, 0, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_merge_symbol_table, __pyx_k_merge_symbol_table, sizeof(__pyx_k_merge_symbol_table), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_minimize, __pyx_k_minimize, sizeof(__pyx_k_minimize), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_kp_u_mode_2, __pyx_k_mode_2, sizeof(__pyx_k_mode_2), 0, 1, 0, 0},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_mpdt_reverse, __pyx_k_mpdt_reverse, sizeof(__pyx_k_mpdt_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_mu, __pyx_k_mu, sizeof(__pyx_k_mu), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_u_neither, __pyx_k_neither, sizeof(__pyx_k_neither), 0, 1, 0, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_next_2, __pyx_k_next_2, sizeof(__pyx_k_next_2), 0, 0, 1, 1},
  {&__pyx_kp_u_not, __pyx_k_not, sizeof(__pyx_k_not), 0, 1, 0, 0},
  {&__pyx_n_s_nu, __pyx_k_nu, sizeof(__pyx_k_nu), 0, 0, 1, 1},
  {&__pyx_n_u_obl, __pyx_k_obl, sizeof(__pyx_k_obl), 0, 1, 0, 1},
  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  {&__pyx_n_s_optimize, __pyx_k_optimize, sizeof(__pyx_k_optimize), 0, 0, 1, 1},
  {&__pyx_n_s_opts, __pyx_k_opts, sizeof(__pyx_k_opts), 0, 0, 1, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_ostring, __pyx_k_ostring, sizeof(__pyx_k_ostring), 0, 0, 1, 1},
  {&__pyx_n_s_ostrings, __pyx_k_ostrings, sizeof(__pyx_k_ostrings), 0, 0, 1, 1},
  {&__pyx_n_s_output_token_type, __pyx_k_output_token_type, sizeof(__pyx_k_output_token_type), 0, 0, 1, 1},
  {&__pyx_n_s_pairs, __pyx_k_pairs, sizeof(__pyx_k_pairs), 0, 0, 1, 1},
  {&__pyx_n_u_paren, __pyx_k_paren, sizeof(__pyx_k_paren), 0, 1, 0, 1},
  {&__pyx_n_s_parens, __pyx_k_parens, sizeof(__pyx_k_parens), 0, 0, 1, 1},
  {&__pyx_n_s_patch, __pyx_k_patch, sizeof(__pyx_k_patch), 0, 0, 1, 1},
  {&__pyx_n_s_path_gc, __pyx_k_path_gc, sizeof(__pyx_k_path_gc), 0, 0, 1, 1},
  {&__pyx_n_s_paths, __pyx_k_paths, sizeof(__pyx_k_paths), 0, 0, 1, 1},
  {&__pyx_n_s_pdt_compose, __pyx_k_pdt_compose, sizeof(__pyx_k_pdt_compose), 0, 0, 1, 1},
  {&__pyx_n_s_pdt_expand, __pyx_k_pdt_expand, sizeof(__pyx_k_pdt_expand), 0, 0, 1, 1},
  {&__pyx_n_s_pdt_parser_type, __pyx_k_pdt_parser_type, sizeof(__pyx_k_pdt_parser_type), 0, 0, 1, 1},
  {&__pyx_n_s_pdt_replace, __pyx_k_pdt_replace, sizeof(__pyx_k_pdt_replace), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_plus, __pyx_k_plus, sizeof(__pyx_k_plus), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_power, __pyx_k_power, sizeof(__pyx_k_power), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_project, __pyx_k_project, sizeof(__pyx_k_project), 0, 0, 1, 1},
  {&__pyx_n_s_prune, __pyx_k_prune, sizeof(__pyx_k_prune), 0, 0, 1, 1},
  {&__pyx_n_s_push, __pyx_k_push, sizeof(__pyx_k_push), 0, 0, 1, 1},
  {&__pyx_n_s_pynini, __pyx_k_pynini, sizeof(__pyx_k_pynini), 0, 0, 1, 1},
  {&__pyx_n_s_pywrapfst, __pyx_k_pywrapfst, sizeof(__pyx_k_pywrapfst), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Far, __pyx_k_pyx_unpickle_Far, sizeof(__pyx_k_pyx_unpickle_Far), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_MPdtParentheses, __pyx_k_pyx_unpickle_MPdtParentheses, sizeof(__pyx_k_pyx_unpickle_MPdtParentheses), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_PdtParentheses, __pyx_k_pyx_unpickle_PdtParentheses, sizeof(__pyx_k_pyx_unpickle_PdtParentheses), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_queue_type, __pyx_k_queue_type, sizeof(__pyx_k_queue_type), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
  {&__pyx_n_s_randequivalent, __pyx_k_randequivalent, sizeof(__pyx_k_randequivalent), 0, 0, 1, 1},
  {&__pyx_n_s_randgen, __pyx_k_randgen, sizeof(__pyx_k_randgen), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_s_read_from_string, __pyx_k_read_from_string, sizeof(__pyx_k_read_from_string), 0, 0, 1, 1},
  {&__pyx_n_s_read_from_string_2, __pyx_k_read_from_string_2, sizeof(__pyx_k_read_from_string_2), 0, 0, 1, 1},
  {&__pyx_n_u_readable, __pyx_k_readable, sizeof(__pyx_k_readable), 0, 1, 0, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_relabel_pairs, __pyx_k_relabel_pairs, sizeof(__pyx_k_relabel_pairs), 0, 0, 1, 1},
  {&__pyx_n_s_relabel_tables, __pyx_k_relabel_tables, sizeof(__pyx_k_relabel_tables), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_result_fst, __pyx_k_result_fst, sizeof(__pyx_k_result_fst), 0, 0, 1, 1},
  {&__pyx_n_s_result_parens, __pyx_k_result_parens, sizeof(__pyx_k_result_parens), 0, 0, 1, 1},
  {&__pyx_n_s_return_arc_labeling, __pyx_k_return_arc_labeling, sizeof(__pyx_k_return_arc_labeling), 0, 0, 1, 1},
  {&__pyx_n_s_return_label, __pyx_k_return_label, sizeof(__pyx_k_return_label), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_reweight, __pyx_k_reweight, sizeof(__pyx_k_reweight), 0, 0, 1, 1},
  {&__pyx_n_s_right_paren_prefix, __pyx_k_right_paren_prefix, sizeof(__pyx_k_right_paren_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_rmepsilon, __pyx_k_rmepsilon, sizeof(__pyx_k_rmepsilon), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_kp_s_self__paths_cannot_be_converted, __pyx_k_self__paths_cannot_be_converted, sizeof(__pyx_k_self__paths_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self__symbols_cannot_be_converte, __pyx_k_self__symbols_cannot_be_converte, sizeof(__pyx_k_self__symbols_cannot_be_converte), 0, 0, 1, 0},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shortestdistance, __pyx_k_shortestdistance, sizeof(__pyx_k_shortestdistance), 0, 0, 1, 1},
  {&__pyx_n_s_shortestdistance_patch, __pyx_k_shortestdistance_patch, sizeof(__pyx_k_shortestdistance_patch), 0, 0, 1, 1},
  {&__pyx_n_s_shortestdistance_patch_locals_p, __pyx_k_shortestdistance_patch_locals_p, sizeof(__pyx_k_shortestdistance_patch_locals_p), 0, 0, 1, 1},
  {&__pyx_n_s_shortestpath, __pyx_k_shortestpath, sizeof(__pyx_k_shortestpath), 0, 0, 1, 1},
  {&__pyx_n_s_sigma_star, __pyx_k_sigma_star, sizeof(__pyx_k_sigma_star), 0, 0, 1, 1},
  {&__pyx_n_u_standard, __pyx_k_standard, sizeof(__pyx_k_standard), 0, 1, 0, 1},
  {&__pyx_n_s_start_paren_labels, __pyx_k_start_paren_labels, sizeof(__pyx_k_start_paren_labels), 0, 0, 1, 1},
  {&__pyx_n_s_statemap, __pyx_k_statemap, sizeof(__pyx_k_statemap), 0, 0, 1, 1},
  {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_symbols, __pyx_k_symbols, sizeof(__pyx_k_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_synchronize, __pyx_k_synchronize, sizeof(__pyx_k_synchronize), 0, 0, 1, 1},
  {&__pyx_n_s_tau, __pyx_k_tau, sizeof(__pyx_k_tau), 0, 0, 1, 1},
  {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_times, __pyx_k_times, sizeof(__pyx_k_times), 0, 0, 1, 1},
  {&__pyx_n_s_token_type, __pyx_k_token_type, sizeof(__pyx_k_token_type), 0, 0, 1, 1},
  {&__pyx_n_s_token_type_2, __pyx_k_token_type_2, sizeof(__pyx_k_token_type_2), 0, 0, 1, 1},
  {&__pyx_n_s_topsort, __pyx_k_topsort, sizeof(__pyx_k_topsort), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1},
  {&__pyx_kp_u_typing_Literal_ltr_rtl_sim, __pyx_k_typing_Literal_ltr_rtl_sim, sizeof(__pyx_k_typing_Literal_ltr_rtl_sim), 0, 1, 0, 0},
  {&__pyx_kp_u_typing_Literal_obl_opt, __pyx_k_typing_Literal_obl_opt, sizeof(__pyx_k_typing_Literal_obl_opt), 0, 1, 0, 0},
  {&__pyx_kp_u_typing_Literal_r_w, __pyx_k_typing_Literal_r_w, sizeof(__pyx_k_typing_Literal_r_w), 0, 1, 0, 0},
  {&__pyx_kp_u_typing_Union_Fst_str, __pyx_k_typing_Union_Fst_str, sizeof(__pyx_k_typing_Union_Fst_str), 0, 1, 0, 0},
  {&__pyx_kp_u_typing_Union_SymbolTableView_typ, __pyx_k_typing_Union_SymbolTableView_typ, sizeof(__pyx_k_typing_Union_SymbolTableView_typ), 0, 1, 0, 0},
  {&__pyx_n_s_union, __pyx_k_union, sizeof(__pyx_k_union), 0, 0, 1, 1},
  {&__pyx_n_s_union_locals_genexpr, __pyx_k_union_locals_genexpr, sizeof(__pyx_k_union_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
  {&__pyx_n_s_weight_2, __pyx_k_weight_2, sizeof(__pyx_k_weight_2), 0, 0, 1, 1},
  {&__pyx_n_s_weights, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 0, 1, 1},
  {&__pyx_n_s_wraps, __pyx_k_wraps, sizeof(__pyx_k_wraps), 0, 0, 1, 1},
  {&__pyx_n_u_writable, __pyx_k_writable, sizeof(__pyx_k_writable), 0, 1, 0, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 148, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 518, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 717, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(0, 725, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 726, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 1206, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 1435, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 2445, __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);

  /* "_pynini.pyx":724
 *         (lower, upper) = other
 *       except ValueError:
 *           raise ValueError("Expected tuple of length two")             # <<<<<<<<<<<<<<
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Expected_tuple_of_length_two); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "_pynini.pyx":726
 *           raise ValueError("Expected tuple of length two")
 *       if lower is Ellipsis:
 *         raise TypeError("The lower bound must be an integer")             # <<<<<<<<<<<<<<
 *       elif upper is Ellipsis:
 *         return closure(self, lower)
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_The_lower_bound_must_be_an_integ); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self__symbols_cannot_be_converte); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":4
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._symbols cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self__symbols_cannot_be_converte); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "_pynini.pyx":1225
 * def _1arg_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return _init_Fst_from_MutableFst(fnc(_fst, *args, **kwargs))
 */
  __pyx_tuple__6 = PyTuple_Pack(4, __pyx_n_s_fst, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_fst_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 1225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1225, __pyx_L1_error)

  /* "_pynini.pyx":1246
 * def _shortestdistance_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst = _compile_or_copy_Fst(fst)
 *     return fnc(_fst, *args, **kwargs)
 */
  __pyx_tuple__8 = PyTuple_Pack(4, __pyx_n_s_fst, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_fst_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 1246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 1246, __pyx_L1_error)

  /* "_pynini.pyx":1262
 * def _compose_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_s_fst1, __pyx_n_s_fst2, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_fst1_2, __pyx_n_s_fst2_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 1262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 1262, __pyx_L1_error)

  /* "_pynini.pyx":1277
 * def _difference_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_tuple__12 = PyTuple_Pack(6, __pyx_n_s_fst1, __pyx_n_s_fst2, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_fst1_2, __pyx_n_s_fst2_2); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 1277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 1277, __pyx_L1_error)

  /* "_pynini.pyx":1295
 * def _comp_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst _fst1
 *     cdef Fst _fst2
 */
  __pyx_tuple__14 = PyTuple_Pack(6, __pyx_n_s_fst1, __pyx_n_s_fst2, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_fst1_2, __pyx_n_s_fst2_2); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 1295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 1295, __pyx_L1_error)

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_self__paths_cannot_be_converted); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "(tree fragment)":4
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._paths cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_self__paths_cannot_be_converted); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "_pynini.pyx":2265
 *   cdef void _check_open(self) except *:
 *     if self.closed():
 *       raise ValueError("I/O operation on closed FAR")             # <<<<<<<<<<<<<<
 * 
 *   cdef void _check_mode(self, char mode) except *:
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_I_O_operation_on_closed_FAR); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "_pynini.pyx":2623
 * def _copy_patch(fnc):
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     cdef Fst result = _compile_or_copy_Fst(arg1)
 *     fnc(result, *args, **kwargs)
 */
  __pyx_tuple__24 = PyTuple_Pack(4, __pyx_n_s_arg1, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_result); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_patch, 2623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 2623, __pyx_L1_error)

  /* "_pynini.pyx":309
 *   """
 * 
 *   def __init__(self, token_type):             # <<<<<<<<<<<<<<
 *     self._token_type = token_type
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_token_type); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_init, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 309, __pyx_L1_error)

  /* "_pynini.pyx":312
 *     self._token_type = token_type
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 */
  __pyx_tuple__28 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_token_type_2, __pyx_n_s_symbols); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_enter, 312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 312, __pyx_L1_error)

  /* "_pynini.pyx":322
 *     PushDefaults(_token_type, _symbols)
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *     PopDefaults()
 * 
 */
  __pyx_tuple__30 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_exit, 322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 322, __pyx_L1_error)

  /* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
  __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_1arg_patch, 1223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 1223, __pyx_L1_error)

  /* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
  __pyx_tuple__34 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_shortestdistance_patch, 1244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 1244, __pyx_L1_error)

  /* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_compose_patch, 1260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 1260, __pyx_L1_error)

  /* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_difference_patch, 1275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 1275, __pyx_L1_error)

  /* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_tuple__40 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_comp_patch, 1293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 1293, __pyx_L1_error)

  /* "_pynini.pyx":1385
 * 
 * 
 * def union(*fsts):             # <<<<<<<<<<<<<<
 *   """
 *   union(*fsts)
 */
  __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_fsts, __pyx_n_s_fst1, __pyx_n_s_fsts2, __pyx_n_s_fst1_2); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 1385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_union, 1385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 1385, __pyx_L1_error)

  /* "_pynini.pyx":1507
 * 
 * 
 * def pdt_compose(fst1,             # <<<<<<<<<<<<<<
 *                 fst2,
 *                 PdtParentheses parens,
 */
  __pyx_tuple__44 = PyTuple_Pack(10, __pyx_n_s_fst1, __pyx_n_s_fst2, __pyx_n_s_parens, __pyx_n_s_compose_filter, __pyx_n_s_left_pdt, __pyx_n_s_fst1_2, __pyx_n_s_fst2_2, __pyx_n_s_result, __pyx_n_s_compose_filter_2, __pyx_n_s_opts); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 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_extensions__pynini_pyx, __pyx_n_s_pdt_compose, 1507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 1507, __pyx_L1_error)

  /* "_pynini.pyx":1558
 * 
 * 
 * def pdt_expand(fst,             # <<<<<<<<<<<<<<
 *                PdtParentheses parens,
 *                bool connect=True,
 */
  __pyx_tuple__46 = PyTuple_Pack(9, __pyx_n_s_fst, __pyx_n_s_parens, __pyx_n_s_connect, __pyx_n_s_keep_parentheses, __pyx_n_s_weight, __pyx_n_s_fst_2, __pyx_n_s_result, __pyx_n_s_weight_2, __pyx_n_s_opts); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 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_extensions__pynini_pyx, __pyx_n_s_pdt_expand, 1558, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1558, __pyx_L1_error)

  /* "_pynini.pyx":1628
 * 
 * 
 * def pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                 pdt_parser_type="left",
 *                 int64_t start_paren_labels=kNoLabel,
 */
  __pyx_tuple__48 = PyTuple_Pack(7, __pyx_n_s_pairs, __pyx_n_s_pdt_parser_type, __pyx_n_s_start_paren_labels, __pyx_n_s_left_paren_prefix, __pyx_n_s_right_paren_prefix, __pyx_n_s_label, __pyx_n_s_fst); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 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_extensions__pynini_pyx, __pyx_n_s_pdt_replace, 1628, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1628, __pyx_L1_error)

  /* "_pynini.pyx":1950
 * 
 * 
 * def mpdt_reverse(fst, MPdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_reverse(fst, parens)
 */
  __pyx_tuple__50 = PyTuple_Pack(5, __pyx_n_s_fst, __pyx_n_s_parens, __pyx_n_s_fst_2, __pyx_n_s_result_fst, __pyx_n_s_result_parens); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_mpdt_reverse, 1950, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1950, __pyx_L1_error)

  /* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */
  __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_fnc, __pyx_n_s_patch, __pyx_n_s_patch); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 2621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_extensions__pynini_pyx, __pyx_n_s_copy_patch, 2621, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 2621, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_PdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__54 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_PdtParentheses, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__56 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_MPdtParentheses, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Far, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(1, 1, __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_int_7916983 = PyInt_FromLong(7916983L); if (unlikely(!__pyx_int_7916983)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_127029315 = PyInt_FromLong(127029315L); if (unlikely(!__pyx_int_127029315)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_213039201 = PyInt_FromLong(213039201L); if (unlikely(!__pyx_int_213039201)) __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
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_t_1 = PyImport_ImportModule("_pywrapfst"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_10_pywrapfst_VectorFst = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "VectorFst", sizeof(struct __pyx_obj_10_pywrapfst_VectorFst), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_VectorFst) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_VectorFst = (struct __pyx_vtabstruct_10_pywrapfst_VectorFst*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_VectorFst->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_VectorFst)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_7_pynini_Fst = &__pyx_vtable_7_pynini_Fst;
  __pyx_vtable_7_pynini_Fst.__pyx_base = *__pyx_vtabptr_10_pywrapfst_VectorFst;
  __pyx_vtable_7_pynini_Fst.__pyx_base.__pyx_base.__pyx_base.copy = (struct __pyx_obj_10_pywrapfst_Fst *(*)(struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Fst_copy__pyx_wrap_1;
  __pyx_vtable_7_pynini_Fst._from_MutableFstClass = (void (*)(struct __pyx_obj_7_pynini_Fst *, fst::script::MutableFstClass *))__pyx_f_7_pynini_3Fst__from_MutableFstClass;
  __pyx_vtable_7_pynini_Fst.paths = (struct __pyx_obj_7_pynini__StringPathIterator *(*)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_paths *__pyx_optional_args))__pyx_f_7_pynini_3Fst_paths;
  __pyx_vtable_7_pynini_Fst.string = (std::string (*)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_7_pynini_3Fst_string *__pyx_optional_args))__pyx_f_7_pynini_3Fst_string;
  __pyx_vtable_7_pynini_Fst.copy = (struct __pyx_obj_7_pynini_Fst *(*)(struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Fst_copy;
  __pyx_vtable_7_pynini_Fst._optimize = (void (*)(struct __pyx_obj_7_pynini_Fst *, struct __pyx_opt_args_7_pynini_3Fst__optimize *__pyx_optional_args))__pyx_f_7_pynini_3Fst__optimize;
  __pyx_type_7_pynini_Fst.tp_base = __pyx_ptype_10_pywrapfst_VectorFst;
  if (PyType_Ready(&__pyx_type_7_pynini_Fst) < 0) __PYX_ERR(0, 332, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini_Fst.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini_Fst.tp_dictoffset && __pyx_type_7_pynini_Fst.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini_Fst.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7_pynini_Fst, "__pow__"); if (unlikely(!wrapper)) __PYX_ERR(0, 332, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7_pynini_3Fst_34__pow__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7_pynini_3Fst_34__pow__.doc = __pyx_doc_7_pynini_3Fst_34__pow__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7_pynini_3Fst_34__pow__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7_pynini_Fst.tp_dict, __pyx_vtabptr_7_pynini_Fst) < 0) __PYX_ERR(0, 332, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Fst, (PyObject *)&__pyx_type_7_pynini_Fst) < 0) __PYX_ERR(0, 332, __pyx_L1_error)
  __pyx_ptype_7_pynini_Fst = &__pyx_type_7_pynini_Fst;
  __pyx_ptype_10_pywrapfst_SymbolTableView = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "SymbolTableView", sizeof(struct __pyx_obj_10_pywrapfst_SymbolTableView), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_SymbolTableView) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_SymbolTableView = (struct __pyx_vtabstruct_10_pywrapfst_SymbolTableView*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_SymbolTableView->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_SymbolTableView)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_7_pynini__PointerSymbolTableView = &__pyx_vtable_7_pynini__PointerSymbolTableView;
  __pyx_vtable_7_pynini__PointerSymbolTableView.__pyx_base = *__pyx_vtabptr_10_pywrapfst_SymbolTableView;
  __pyx_vtable_7_pynini__PointerSymbolTableView.__pyx_base._raw = (fst::SymbolTable const *(*)(struct __pyx_obj_10_pywrapfst_SymbolTableView *))__pyx_f_7_pynini_23_PointerSymbolTableView__raw;
  __pyx_type_7_pynini__PointerSymbolTableView.tp_base = __pyx_ptype_10_pywrapfst_SymbolTableView;
  if (PyType_Ready(&__pyx_type_7_pynini__PointerSymbolTableView) < 0) __PYX_ERR(0, 1189, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini__PointerSymbolTableView.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini__PointerSymbolTableView.tp_dictoffset && __pyx_type_7_pynini__PointerSymbolTableView.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini__PointerSymbolTableView.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7_pynini__PointerSymbolTableView.tp_dict, __pyx_vtabptr_7_pynini__PointerSymbolTableView) < 0) __PYX_ERR(0, 1189, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PointerSymbolTableView, (PyObject *)&__pyx_type_7_pynini__PointerSymbolTableView) < 0) __PYX_ERR(0, 1189, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7_pynini__PointerSymbolTableView) < 0) __PYX_ERR(0, 1189, __pyx_L1_error)
  __pyx_ptype_7_pynini__PointerSymbolTableView = &__pyx_type_7_pynini__PointerSymbolTableView;
  __pyx_vtabptr_7_pynini_PdtParentheses = &__pyx_vtable_7_pynini_PdtParentheses;
  __pyx_vtable_7_pynini_PdtParentheses.copy = (struct __pyx_obj_7_pynini_PdtParentheses *(*)(struct __pyx_obj_7_pynini_PdtParentheses *, int __pyx_skip_dispatch))__pyx_f_7_pynini_14PdtParentheses_copy;
  __pyx_vtable_7_pynini_PdtParentheses.add_pair = (void (*)(struct __pyx_obj_7_pynini_PdtParentheses *, int64_t, int64_t, int __pyx_skip_dispatch))__pyx_f_7_pynini_14PdtParentheses_add_pair;
  __pyx_vtable_7_pynini_PdtParentheses.write = (void (*)(struct __pyx_obj_7_pynini_PdtParentheses *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7_pynini_14PdtParentheses_write;
  if (PyType_Ready(&__pyx_type_7_pynini_PdtParentheses) < 0) __PYX_ERR(0, 1409, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini_PdtParentheses.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini_PdtParentheses.tp_dictoffset && __pyx_type_7_pynini_PdtParentheses.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini_PdtParentheses.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7_pynini_PdtParentheses.tp_dict, __pyx_vtabptr_7_pynini_PdtParentheses) < 0) __PYX_ERR(0, 1409, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PdtParentheses, (PyObject *)&__pyx_type_7_pynini_PdtParentheses) < 0) __PYX_ERR(0, 1409, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7_pynini_PdtParentheses) < 0) __PYX_ERR(0, 1409, __pyx_L1_error)
  __pyx_ptype_7_pynini_PdtParentheses = &__pyx_type_7_pynini_PdtParentheses;
  __pyx_vtabptr_7_pynini_MPdtParentheses = &__pyx_vtable_7_pynini_MPdtParentheses;
  __pyx_vtable_7_pynini_MPdtParentheses.copy = (struct __pyx_obj_7_pynini_MPdtParentheses *(*)(struct __pyx_obj_7_pynini_MPdtParentheses *, int __pyx_skip_dispatch))__pyx_f_7_pynini_15MPdtParentheses_copy;
  __pyx_vtable_7_pynini_MPdtParentheses.add_triple = (void (*)(struct __pyx_obj_7_pynini_MPdtParentheses *, int64_t, int64_t, int64_t, int __pyx_skip_dispatch))__pyx_f_7_pynini_15MPdtParentheses_add_triple;
  __pyx_vtable_7_pynini_MPdtParentheses.write = (void (*)(struct __pyx_obj_7_pynini_MPdtParentheses *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7_pynini_15MPdtParentheses_write;
  if (PyType_Ready(&__pyx_type_7_pynini_MPdtParentheses) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini_MPdtParentheses.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini_MPdtParentheses.tp_dictoffset && __pyx_type_7_pynini_MPdtParentheses.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini_MPdtParentheses.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7_pynini_MPdtParentheses.tp_dict, __pyx_vtabptr_7_pynini_MPdtParentheses) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MPdtParentheses, (PyObject *)&__pyx_type_7_pynini_MPdtParentheses) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7_pynini_MPdtParentheses) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  __pyx_ptype_7_pynini_MPdtParentheses = &__pyx_type_7_pynini_MPdtParentheses;
  __pyx_vtabptr_7_pynini__StringPathIterator = &__pyx_vtable_7_pynini__StringPathIterator;
  __pyx_vtable_7_pynini__StringPathIterator.done = (bool (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_done;
  __pyx_vtable_7_pynini__StringPathIterator.error = (bool (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_error;
  __pyx_vtable_7_pynini__StringPathIterator.istring = (std::string (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_istring;
  __pyx_vtable_7_pynini__StringPathIterator.next = (void (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_next;
  __pyx_vtable_7_pynini__StringPathIterator.reset = (void (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_reset;
  __pyx_vtable_7_pynini__StringPathIterator.ostring = (std::string (*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_ostring;
  __pyx_vtable_7_pynini__StringPathIterator.weight = (struct __pyx_obj_10_pywrapfst_Weight *(*)(struct __pyx_obj_7_pynini__StringPathIterator *, int __pyx_skip_dispatch))__pyx_f_7_pynini_19_StringPathIterator_weight;
  if (PyType_Ready(&__pyx_type_7_pynini__StringPathIterator) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini__StringPathIterator.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini__StringPathIterator.tp_dictoffset && __pyx_type_7_pynini__StringPathIterator.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini__StringPathIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7_pynini__StringPathIterator.tp_dict, __pyx_vtabptr_7_pynini__StringPathIterator) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_StringPathIterator, (PyObject *)&__pyx_type_7_pynini__StringPathIterator) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7_pynini__StringPathIterator) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
  __pyx_ptype_7_pynini__StringPathIterator = &__pyx_type_7_pynini__StringPathIterator;
  __pyx_vtabptr_7_pynini_Far = &__pyx_vtable_7_pynini_Far;
  __pyx_vtable_7_pynini_Far._check_open = (void (*)(struct __pyx_obj_7_pynini_Far *))__pyx_f_7_pynini_3Far__check_open;
  __pyx_vtable_7_pynini_Far._check_mode = (void (*)(struct __pyx_obj_7_pynini_Far *, char))__pyx_f_7_pynini_3Far__check_mode;
  __pyx_vtable_7_pynini_Far.error = (bool (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_error;
  __pyx_vtable_7_pynini_Far.arc_type = (std::string (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_arc_type;
  __pyx_vtable_7_pynini_Far.closed = (bool (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_closed;
  __pyx_vtable_7_pynini_Far.far_type = (std::string (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_far_type;
  __pyx_vtable_7_pynini_Far.mode = (std::string (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_mode;
  __pyx_vtable_7_pynini_Far.name = (std::string (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_name;
  __pyx_vtable_7_pynini_Far.done = (bool (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_done;
  __pyx_vtable_7_pynini_Far.find = (bool (*)(struct __pyx_obj_7_pynini_Far *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_find;
  __pyx_vtable_7_pynini_Far.get_fst = (struct __pyx_obj_7_pynini_Fst *(*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_get_fst;
  __pyx_vtable_7_pynini_Far.get_key = (std::string (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_get_key;
  __pyx_vtable_7_pynini_Far.next = (void (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_next;
  __pyx_vtable_7_pynini_Far.reset = (void (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_reset;
  __pyx_vtable_7_pynini_Far.add = (void (*)(struct __pyx_obj_7_pynini_Far *, PyObject *, struct __pyx_obj_7_pynini_Fst *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_add;
  __pyx_vtable_7_pynini_Far.close = (void (*)(struct __pyx_obj_7_pynini_Far *, int __pyx_skip_dispatch))__pyx_f_7_pynini_3Far_close;
  if (PyType_Ready(&__pyx_type_7_pynini_Far) < 0) __PYX_ERR(0, 2218, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini_Far.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini_Far.tp_dictoffset && __pyx_type_7_pynini_Far.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini_Far.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7_pynini_Far.tp_dict, __pyx_vtabptr_7_pynini_Far) < 0) __PYX_ERR(0, 2218, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Far_2, (PyObject *)&__pyx_type_7_pynini_Far) < 0) __PYX_ERR(0, 2218, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7_pynini_Far) < 0) __PYX_ERR(0, 2218, __pyx_L1_error)
  __pyx_ptype_7_pynini_Far = &__pyx_type_7_pynini_Far;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct__union) < 0) __PYX_ERR(0, 680, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct__union.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct__union.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct__union.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct__union.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct__union = &__pyx_type_7_pynini___pyx_scope_struct__union;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_1_genexpr = &__pyx_type_7_pynini___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch) < 0) __PYX_ERR(0, 1223, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_2__1arg_patch = &__pyx_type_7_pynini___pyx_scope_struct_2__1arg_patch;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch) < 0) __PYX_ERR(0, 1244, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_3__shortestdistance_patch = &__pyx_type_7_pynini___pyx_scope_struct_3__shortestdistance_patch;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_4__compose_patch) < 0) __PYX_ERR(0, 1260, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_4__compose_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_4__compose_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_4__compose_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_4__compose_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_4__compose_patch = &__pyx_type_7_pynini___pyx_scope_struct_4__compose_patch;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_5__difference_patch) < 0) __PYX_ERR(0, 1275, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_5__difference_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_5__difference_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_5__difference_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_5__difference_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_5__difference_patch = &__pyx_type_7_pynini___pyx_scope_struct_5__difference_patch;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_6__comp_patch) < 0) __PYX_ERR(0, 1293, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_6__comp_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_6__comp_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_6__comp_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_6__comp_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_6__comp_patch = &__pyx_type_7_pynini___pyx_scope_struct_6__comp_patch;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(0, 1433, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_7___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_7___iter__.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_7___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_7___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_7___iter__ = &__pyx_type_7_pynini___pyx_scope_struct_7___iter__;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_8___iter__) < 0) __PYX_ERR(0, 1777, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_8___iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_8___iter__.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_8___iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_8___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_8___iter__ = &__pyx_type_7_pynini___pyx_scope_struct_8___iter__;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_9_istrings) < 0) __PYX_ERR(0, 2109, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_9_istrings.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_9_istrings.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_9_istrings.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_9_istrings.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_9_istrings = &__pyx_type_7_pynini___pyx_scope_struct_9_istrings;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_10_items) < 0) __PYX_ERR(0, 2125, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_10_items.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_10_items.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_10_items.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_10_items.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_10_items = &__pyx_type_7_pynini___pyx_scope_struct_10_items;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_11_ostrings) < 0) __PYX_ERR(0, 2169, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_11_ostrings.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_11_ostrings.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_11_ostrings.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_11_ostrings.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_11_ostrings = &__pyx_type_7_pynini___pyx_scope_struct_11_ostrings;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_12_weights) < 0) __PYX_ERR(0, 2198, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_12_weights.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_12_weights.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_12_weights.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_12_weights.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_12_weights = &__pyx_type_7_pynini___pyx_scope_struct_12_weights;
  if (PyType_Ready(&__pyx_type_7_pynini___pyx_scope_struct_13__copy_patch) < 0) __PYX_ERR(0, 2621, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7_pynini___pyx_scope_struct_13__copy_patch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7_pynini___pyx_scope_struct_13__copy_patch.tp_dictoffset && __pyx_type_7_pynini___pyx_scope_struct_13__copy_patch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7_pynini___pyx_scope_struct_13__copy_patch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7_pynini___pyx_scope_struct_13__copy_patch = &__pyx_type_7_pynini___pyx_scope_struct_13__copy_patch;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("_pywrapfst"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_10_pywrapfst_Weight = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "Weight", sizeof(struct __pyx_obj_10_pywrapfst_Weight), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_Weight) __PYX_ERR(2, 72, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_Weight = (struct __pyx_vtabstruct_10_pywrapfst_Weight*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_Weight->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_Weight)) __PYX_ERR(2, 72, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__EncodeMapperSymbolTableView = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_EncodeMapperSymbolTableView", sizeof(struct __pyx_obj_10_pywrapfst__EncodeMapperSymbolTableView), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__EncodeMapperSymbolTableView) __PYX_ERR(2, 139, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__EncodeMapperSymbolTableView = (struct __pyx_vtabstruct_10_pywrapfst__EncodeMapperSymbolTableView*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__EncodeMapperSymbolTableView->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__EncodeMapperSymbolTableView)) __PYX_ERR(2, 139, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__FstSymbolTableView = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_FstSymbolTableView", sizeof(struct __pyx_obj_10_pywrapfst__FstSymbolTableView), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__FstSymbolTableView) __PYX_ERR(2, 147, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__FstSymbolTableView = (struct __pyx_vtabstruct_10_pywrapfst__FstSymbolTableView*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__FstSymbolTableView->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__FstSymbolTableView)) __PYX_ERR(2, 147, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__MutableSymbolTable = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_MutableSymbolTable", sizeof(struct __pyx_obj_10_pywrapfst__MutableSymbolTable), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__MutableSymbolTable) __PYX_ERR(2, 155, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__MutableSymbolTable = (struct __pyx_vtabstruct_10_pywrapfst__MutableSymbolTable*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__MutableSymbolTable->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__MutableSymbolTable)) __PYX_ERR(2, 155, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__MutableFstSymbolTableView = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_MutableFstSymbolTableView", sizeof(struct __pyx_obj_10_pywrapfst__MutableFstSymbolTableView), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__MutableFstSymbolTableView) __PYX_ERR(2, 168, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__MutableFstSymbolTableView = (struct __pyx_vtabstruct_10_pywrapfst__MutableFstSymbolTableView*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__MutableFstSymbolTableView->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__MutableFstSymbolTableView)) __PYX_ERR(2, 168, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_SymbolTable = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "SymbolTable", sizeof(struct __pyx_obj_10_pywrapfst_SymbolTable), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_SymbolTable) __PYX_ERR(2, 176, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_SymbolTable = (struct __pyx_vtabstruct_10_pywrapfst_SymbolTable*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_SymbolTable->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_SymbolTable)) __PYX_ERR(2, 176, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__SymbolTableIterator = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_SymbolTableIterator", sizeof(struct __pyx_obj_10_pywrapfst__SymbolTableIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__SymbolTableIterator) __PYX_ERR(2, 199, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_EncodeMapper = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "EncodeMapper", sizeof(struct __pyx_obj_10_pywrapfst_EncodeMapper), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_EncodeMapper) __PYX_ERR(2, 211, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_EncodeMapper = (struct __pyx_vtabstruct_10_pywrapfst_EncodeMapper*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_EncodeMapper->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_EncodeMapper)) __PYX_ERR(2, 211, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_Fst = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "Fst", sizeof(struct __pyx_obj_10_pywrapfst_Fst), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_Fst) __PYX_ERR(2, 248, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_Fst = (struct __pyx_vtabstruct_10_pywrapfst_Fst*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_Fst->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_Fst)) __PYX_ERR(2, 248, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_MutableFst = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "MutableFst", sizeof(struct __pyx_obj_10_pywrapfst_MutableFst), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_MutableFst) __PYX_ERR(2, 314, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_MutableFst = (struct __pyx_vtabstruct_10_pywrapfst_MutableFst*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_MutableFst->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_MutableFst)) __PYX_ERR(2, 314, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_Arc = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "Arc", sizeof(struct __pyx_obj_10_pywrapfst_Arc), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_Arc) __PYX_ERR(2, 417, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_Arc = (struct __pyx_vtabstruct_10_pywrapfst_Arc*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_Arc->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_Arc)) __PYX_ERR(2, 417, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__ArcIterator = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_ArcIterator", sizeof(struct __pyx_obj_10_pywrapfst__ArcIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__ArcIterator) __PYX_ERR(2, 427, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__ArcIterator = (struct __pyx_vtabstruct_10_pywrapfst__ArcIterator*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__ArcIterator->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__ArcIterator)) __PYX_ERR(2, 427, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__MutableArcIterator = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_MutableArcIterator", sizeof(struct __pyx_obj_10_pywrapfst__MutableArcIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__MutableArcIterator) __PYX_ERR(2, 449, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__MutableArcIterator = (struct __pyx_vtabstruct_10_pywrapfst__MutableArcIterator*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__MutableArcIterator->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__MutableArcIterator)) __PYX_ERR(2, 449, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst__StateIterator = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "_StateIterator", sizeof(struct __pyx_obj_10_pywrapfst__StateIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst__StateIterator) __PYX_ERR(2, 473, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst__StateIterator = (struct __pyx_vtabstruct_10_pywrapfst__StateIterator*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst__StateIterator->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst__StateIterator)) __PYX_ERR(2, 473, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_Compiler = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "Compiler", sizeof(struct __pyx_obj_10_pywrapfst_Compiler), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_Compiler) __PYX_ERR(2, 595, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_Compiler = (struct __pyx_vtabstruct_10_pywrapfst_Compiler*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_Compiler->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_Compiler)) __PYX_ERR(2, 595, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_FarReader = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "FarReader", sizeof(struct __pyx_obj_10_pywrapfst_FarReader), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_FarReader) __PYX_ERR(2, 616, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_FarReader = (struct __pyx_vtabstruct_10_pywrapfst_FarReader*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_FarReader->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_FarReader)) __PYX_ERR(2, 616, __pyx_L1_error)
  __pyx_ptype_10_pywrapfst_FarWriter = __Pyx_ImportType(__pyx_t_1, "_pywrapfst", "FarWriter", sizeof(struct __pyx_obj_10_pywrapfst_FarWriter), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10_pywrapfst_FarWriter) __PYX_ERR(2, 641, __pyx_L1_error)
  __pyx_vtabptr_10_pywrapfst_FarWriter = (struct __pyx_vtabstruct_10_pywrapfst_FarWriter*)__Pyx_GetVtable(__pyx_ptype_10_pywrapfst_FarWriter->tp_dict); if (unlikely(!__pyx_vtabptr_10_pywrapfst_FarWriter)) __PYX_ERR(2, 641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("_pywrapfst"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "tostring", (void (**)(void))&__pyx_f_10_pywrapfst_tostring, "std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "path_tostring", (void (**)(void))&__pyx_f_10_pywrapfst_path_tostring, "std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "_get_compose_filter", (void (**)(void))&__pyx_f_10_pywrapfst__get_compose_filter, "enum fst::ComposeFilter (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "_get_queue_type", (void (**)(void))&__pyx_f_10_pywrapfst__get_queue_type, "enum fst::QueueType (std::string const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "_get_replace_label_type", (void (**)(void))&__pyx_f_10_pywrapfst__get_replace_label_type, "enum fst::ReplaceLabelType (std::string const &, bool)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "_get_WeightClass_or_one", (void (**)(void))&__pyx_f_10_pywrapfst__get_WeightClass_or_one, "fst::script::WeightClass (std::string const &, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "_get_WeightClass_or_zero", (void (**)(void))&__pyx_f_10_pywrapfst__get_WeightClass_or_zero, "fst::script::WeightClass (std::string const &, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "equal", (void (**)(void))&__pyx_f_10_pywrapfst_equal, "bool (struct __pyx_obj_10_pywrapfst_Fst *, struct __pyx_obj_10_pywrapfst_Fst *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_equal *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "replace", (void (**)(void))&__pyx_f_10_pywrapfst_replace, "struct __pyx_obj_10_pywrapfst_MutableFst *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_10_pywrapfst_replace *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#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 init_pynini(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC init_pynini(void)
#else
__Pyx_PyMODINIT_FUNC PyInit__pynini(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__pynini(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__pynini(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;
  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 '_pynini' 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__pynini(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(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #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("_pynini", __pyx_methods, __pyx_k_Pynini_finite_state_grammar_comp, 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__pynini) {
    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, "_pynini")) {
      if (unlikely(PyDict_SetItemString(modules, "_pynini", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "_pynini.pyx":133
 * 
 * 
 * import contextlib             # <<<<<<<<<<<<<<
 * import functools
 * import io
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_contextlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextlib, __pyx_t_1) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":134
 * 
 * import contextlib
 * import functools             # <<<<<<<<<<<<<<
 * import io
 * import os
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_functools, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_functools, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":135
 * import contextlib
 * import functools
 * import io             # <<<<<<<<<<<<<<
 * import os
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":136
 * import functools
 * import io
 * import os             # <<<<<<<<<<<<<<
 * 
 * from _pywrapfst import FstArgError
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":138
 * import os
 * 
 * from _pywrapfst import FstArgError             # <<<<<<<<<<<<<<
 * from _pywrapfst import FstIOError
 * from _pywrapfst import FstOpError
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FstArgError);
  __Pyx_GIVEREF(__pyx_n_s_FstArgError);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FstArgError);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __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_FstArgError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstArgError, __pyx_t_1) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":139
 * 
 * from _pywrapfst import FstArgError
 * from _pywrapfst import FstIOError             # <<<<<<<<<<<<<<
 * from _pywrapfst import FstOpError
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_FstIOError);
  __Pyx_GIVEREF(__pyx_n_s_FstIOError);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_FstIOError);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __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_FstIOError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstIOError, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":140
 * from _pywrapfst import FstArgError
 * from _pywrapfst import FstIOError
 * from _pywrapfst import FstOpError             # <<<<<<<<<<<<<<
 * 
 * import _pywrapfst
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FstOpError);
  __Pyx_GIVEREF(__pyx_n_s_FstOpError);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FstOpError);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __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_FstOpError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstOpError, __pyx_t_1) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":142
 * from _pywrapfst import FstOpError
 * 
 * import _pywrapfst             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pywrapfst, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pywrapfst, __pyx_t_2) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":148
 * 
 * 
 * class FstStringCompilationError(FstArgError, ValueError):             # <<<<<<<<<<<<<<
 * 
 *   pass
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FstArgError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_ValueError);
  __Pyx_GIVEREF(__pyx_builtin_ValueError);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_ValueError);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FstStringCompilationError, __pyx_n_s_FstStringCompilationError, (PyObject *) NULL, __pyx_n_s_pynini, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FstStringCompilationError, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstStringCompilationError, __pyx_t_4) < 0) __PYX_ERR(0, 148, __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;

  /* "_pynini.pyx":289
 * 
 * 
 * class default_token_type(contextlib.ContextDecorator):             # <<<<<<<<<<<<<<
 *   """Override the default token_type used by Pynini functions and classes.
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_contextlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ContextDecorator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_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, 289, __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, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_default_token_type, __pyx_n_s_default_token_type, (PyObject *) NULL, __pyx_n_s_pynini, __pyx_kp_s_Override_the_default_token_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "_pynini.pyx":309
 *   """
 * 
 *   def __init__(self, token_type):             # <<<<<<<<<<<<<<
 *     self._token_type = token_type
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_18default_token_type_1__init__, 0, __pyx_n_s_default_token_type___init, NULL, __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":312
 *     self._token_type = token_type
 * 
 *   def __enter__(self):             # <<<<<<<<<<<<<<
 *     cdef _TokenType _token_type
 *     cdef const_SymbolTable_ptr _symbols = NULL
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_18default_token_type_3__enter__, 0, __pyx_n_s_default_token_type___enter, NULL, __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_enter, __pyx_t_4) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":322
 *     PushDefaults(_token_type, _symbols)
 * 
 *   def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *     PopDefaults()
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7_pynini_18default_token_type_5__exit__, 0, __pyx_n_s_default_token_type___exit, NULL, __pyx_n_s_pynini, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_exit, __pyx_t_4) < 0) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_pynini.pyx":289
 * 
 * 
 * class default_token_type(contextlib.ContextDecorator):             # <<<<<<<<<<<<<<
 *   """Override the default token_type used by Pynini functions and classes.
 * 
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_default_token_type, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_token_type, __pyx_t_4) < 0) __PYX_ERR(0, 289, __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;

  /* "_pynini.pyx":362
 * 
 *   @classmethod
 *   def from_pywrapfst(cls, _Fst fst):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.from_pywrapfst(fst)
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7_pynini_Fst, __pyx_n_s_from_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "_pynini.pyx":361
 *     self._from_MutableFstClass(_tfst.release())
 * 
 *   @classmethod             # <<<<<<<<<<<<<<
 *   def from_pywrapfst(cls, _Fst fst):
 *     """
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7_pynini_Fst->tp_dict, __pyx_n_s_from_pywrapfst, __pyx_t_2) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7_pynini_Fst);

  /* "_pynini.pyx":384
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(filename)
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_7_pynini_Fst, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "_pynini.pyx":383
 *     return _from_pywrapfst(fst)
 * 
 *   @classmethod             # <<<<<<<<<<<<<<
 *   def read(cls, filename):
 *     """
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7_pynini_Fst->tp_dict, __pyx_n_s_read, __pyx_t_1) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7_pynini_Fst);

  /* "_pynini.pyx":402
 * 
 *   @classmethod
 *   def read_from_string(cls, state):             # <<<<<<<<<<<<<<
 *     """
 *     Fst.read(string)
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7_pynini_Fst, __pyx_n_s_read_from_string_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "_pynini.pyx":401
 *     return _read(filename)
 * 
 *   @classmethod             # <<<<<<<<<<<<<<
 *   def read_from_string(cls, state):
 *     """
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7_pynini_Fst->tp_dict, __pyx_n_s_read_from_string_2, __pyx_t_2) < 0) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7_pynini_Fst);

  /* "_pynini.pyx":1223
 * 
 * 
 * def _1arg_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_23_1arg_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_1arg_patch, __pyx_t_2) < 0) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1231
 * 
 * 
 * arcmap = _1arg_patch(_pywrapfst.arcmap)             # <<<<<<<<<<<<<<
 * determinize = _1arg_patch(_pywrapfst.determinize)
 * disambiguate = _1arg_patch(_pywrapfst.disambiguate)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arcmap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); 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_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_arcmap, __pyx_t_1) < 0) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1232
 * 
 * arcmap = _1arg_patch(_pywrapfst.arcmap)
 * determinize = _1arg_patch(_pywrapfst.determinize)             # <<<<<<<<<<<<<<
 * disambiguate = _1arg_patch(_pywrapfst.disambiguate)
 * epsnormalize = _1arg_patch(_pywrapfst.epsnormalize)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_determinize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1232, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_determinize, __pyx_t_3) < 0) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1233
 * arcmap = _1arg_patch(_pywrapfst.arcmap)
 * determinize = _1arg_patch(_pywrapfst.determinize)
 * disambiguate = _1arg_patch(_pywrapfst.disambiguate)             # <<<<<<<<<<<<<<
 * epsnormalize = _1arg_patch(_pywrapfst.epsnormalize)
 * prune = _1arg_patch(_pywrapfst.prune)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_disambiguate); 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;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_disambiguate, __pyx_t_2) < 0) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1234
 * determinize = _1arg_patch(_pywrapfst.determinize)
 * disambiguate = _1arg_patch(_pywrapfst.disambiguate)
 * epsnormalize = _1arg_patch(_pywrapfst.epsnormalize)             # <<<<<<<<<<<<<<
 * prune = _1arg_patch(_pywrapfst.prune)
 * push = _1arg_patch(_pywrapfst.push)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_epsnormalize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_epsnormalize, __pyx_t_1) < 0) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1235
 * disambiguate = _1arg_patch(_pywrapfst.disambiguate)
 * epsnormalize = _1arg_patch(_pywrapfst.epsnormalize)
 * prune = _1arg_patch(_pywrapfst.prune)             # <<<<<<<<<<<<<<
 * push = _1arg_patch(_pywrapfst.push)
 * randgen = _1arg_patch(_pywrapfst.randgen)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); 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_prune); 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 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1235, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prune, __pyx_t_3) < 0) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1236
 * epsnormalize = _1arg_patch(_pywrapfst.epsnormalize)
 * prune = _1arg_patch(_pywrapfst.prune)
 * push = _1arg_patch(_pywrapfst.push)             # <<<<<<<<<<<<<<
 * randgen = _1arg_patch(_pywrapfst.randgen)
 * reverse = _1arg_patch(_pywrapfst.reverse)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_push); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_push, __pyx_t_2) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1237
 * prune = _1arg_patch(_pywrapfst.prune)
 * push = _1arg_patch(_pywrapfst.push)
 * randgen = _1arg_patch(_pywrapfst.randgen)             # <<<<<<<<<<<<<<
 * reverse = _1arg_patch(_pywrapfst.reverse)
 * shortestpath = _1arg_patch(_pywrapfst.shortestpath)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_randgen); 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_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1237, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_randgen, __pyx_t_1) < 0) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1238
 * push = _1arg_patch(_pywrapfst.push)
 * randgen = _1arg_patch(_pywrapfst.randgen)
 * reverse = _1arg_patch(_pywrapfst.reverse)             # <<<<<<<<<<<<<<
 * shortestpath = _1arg_patch(_pywrapfst.shortestpath)
 * statemap = _1arg_patch(_pywrapfst.statemap)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); 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_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reverse, __pyx_t_3) < 0) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1239
 * randgen = _1arg_patch(_pywrapfst.randgen)
 * reverse = _1arg_patch(_pywrapfst.reverse)
 * shortestpath = _1arg_patch(_pywrapfst.shortestpath)             # <<<<<<<<<<<<<<
 * statemap = _1arg_patch(_pywrapfst.statemap)
 * synchronize = _1arg_patch(_pywrapfst.synchronize)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shortestpath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_shortestpath, __pyx_t_2) < 0) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1240
 * reverse = _1arg_patch(_pywrapfst.reverse)
 * shortestpath = _1arg_patch(_pywrapfst.shortestpath)
 * statemap = _1arg_patch(_pywrapfst.statemap)             # <<<<<<<<<<<<<<
 * synchronize = _1arg_patch(_pywrapfst.synchronize)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_statemap); 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_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_statemap, __pyx_t_1) < 0) __PYX_ERR(0, 1240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1241
 * shortestpath = _1arg_patch(_pywrapfst.shortestpath)
 * statemap = _1arg_patch(_pywrapfst.statemap)
 * synchronize = _1arg_patch(_pywrapfst.synchronize)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_1arg_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_synchronize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_synchronize, __pyx_t_3) < 0) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1244
 * 
 * 
 * def _shortestdistance_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst, *args, **kwargs):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_25_shortestdistance_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_shortestdistance_patch, __pyx_t_3) < 0) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1252
 * 
 * 
 * shortestdistance = _shortestdistance_patch(_pywrapfst.shortestdistance)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_shortestdistance_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shortestdistance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_shortestdistance, __pyx_t_2) < 0) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1260
 * 
 * 
 * def _compose_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_27_compose_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compose_patch, __pyx_t_2) < 0) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1271
 * 
 * 
 * compose = _compose_patch(_pywrapfst.compose)             # <<<<<<<<<<<<<<
 * intersect = _compose_patch(_pywrapfst.intersect)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compose_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compose); 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_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compose, __pyx_t_1) < 0) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1272
 * 
 * compose = _compose_patch(_pywrapfst.compose)
 * intersect = _compose_patch(_pywrapfst.intersect)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_compose_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_intersect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); 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_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_intersect, __pyx_t_3) < 0) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1275
 * 
 * 
 * def _difference_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_29_difference_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_difference_patch, __pyx_t_3) < 0) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1287
 * 
 * 
 * difference = _difference_patch(_pywrapfst.difference)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_difference_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_difference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_difference, __pyx_t_2) < 0) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1293
 * 
 * 
 * def _comp_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(fst1, fst2, *args, **kwargs):
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_31_comp_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_comp_patch, __pyx_t_2) < 0) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1303
 * 
 * 
 * equal = _comp_patch(_pywrapfst.equal)             # <<<<<<<<<<<<<<
 * equivalent = _comp_patch(_pywrapfst.equivalent)
 * isomorphic = _comp_patch(_pywrapfst.isomorphic)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_comp_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_equal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_equal, __pyx_t_1) < 0) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1304
 * 
 * equal = _comp_patch(_pywrapfst.equal)
 * equivalent = _comp_patch(_pywrapfst.equivalent)             # <<<<<<<<<<<<<<
 * isomorphic = _comp_patch(_pywrapfst.isomorphic)
 * randequivalent = _comp_patch(_pywrapfst.randequivalent)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_comp_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_equivalent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_equivalent, __pyx_t_3) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1305
 * equal = _comp_patch(_pywrapfst.equal)
 * equivalent = _comp_patch(_pywrapfst.equivalent)
 * isomorphic = _comp_patch(_pywrapfst.isomorphic)             # <<<<<<<<<<<<<<
 * randequivalent = _comp_patch(_pywrapfst.randequivalent)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_comp_patch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isomorphic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_isomorphic, __pyx_t_2) < 0) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":1306
 * equivalent = _comp_patch(_pywrapfst.equivalent)
 * isomorphic = _comp_patch(_pywrapfst.isomorphic)
 * randequivalent = _comp_patch(_pywrapfst.randequivalent)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_comp_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pywrapfst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_randequivalent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1306, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_randequivalent, __pyx_t_1) < 0) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1385
 * 
 * 
 * def union(*fsts):             # <<<<<<<<<<<<<<
 *   """
 *   union(*fsts)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_37union, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_union, __pyx_t_1) < 0) __PYX_ERR(0, 1385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":1464
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     PdtParentheses.read(filename)
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7_pynini_PdtParentheses, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "_pynini.pyx":1463
 *     self._parens.push_back(pair[int64_t, int64_t](push, pop))
 * 
 *   @classmethod             # <<<<<<<<<<<<<<
 *   def read(cls, filename):
 *     """
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7_pynini_PdtParentheses->tp_dict, __pyx_n_s_read, __pyx_t_3) < 0) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7_pynini_PdtParentheses);

  /* "_pynini.pyx":1507
 * 
 * 
 * def pdt_compose(fst1,             # <<<<<<<<<<<<<<
 *                 fst2,
 *                 PdtParentheses parens,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_39pdt_compose, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pdt_compose, __pyx_t_3) < 0) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1558
 * 
 * 
 * def pdt_expand(fst,             # <<<<<<<<<<<<<<
 *                PdtParentheses parens,
 *                bool connect=True,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_41pdt_expand, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pdt_expand, __pyx_t_3) < 0) __PYX_ERR(0, 1558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1606
 * cdef object _pdt_replace(pairs,
 *                          pdt_parser_type="left",
 *                          int64_t start_paren_labels=kNoLabel,             # <<<<<<<<<<<<<<
 *                          left_paren_prefix="(_",
 *                          right_paren_prefix=")_"):
 */
  __pyx_k__17 = fst::kNoLabel;

  /* "_pynini.pyx":1630
 * def pdt_replace(pairs,
 *                 pdt_parser_type="left",
 *                 int64_t start_paren_labels=kNoLabel,             # <<<<<<<<<<<<<<
 *                 left_paren_prefix="(_",
 *                 right_paren_prefix=")_"):
 */
  __pyx_k__20 = fst::kNoLabel;

  /* "_pynini.pyx":1628
 * 
 * 
 * def pdt_replace(pairs,             # <<<<<<<<<<<<<<
 *                 pdt_parser_type="left",
 *                 int64_t start_paren_labels=kNoLabel,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_43pdt_replace, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pdt_replace, __pyx_t_3) < 0) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1813
 * 
 *   @classmethod
 *   def read(cls, filename):             # <<<<<<<<<<<<<<
 *     """
 *     MPdtParentheses.read(filename)
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7_pynini_MPdtParentheses, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "_pynini.pyx":1812
 *     self._assign.push_back(assignment)
 * 
 *   @classmethod             # <<<<<<<<<<<<<<
 *   def read(cls, filename):
 *     """
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7_pynini_MPdtParentheses->tp_dict, __pyx_n_s_read, __pyx_t_1) < 0) __PYX_ERR(0, 1813, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_7_pynini_MPdtParentheses);

  /* "_pynini.pyx":1950
 * 
 * 
 * def mpdt_reverse(fst, MPdtParentheses parens):             # <<<<<<<<<<<<<<
 *   """
 *   mpdt_reverse(fst, parens)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_53mpdt_reverse, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mpdt_reverse, __pyx_t_1) < 0) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2506
 * 
 * 
 * from _pywrapfst import Arc             # <<<<<<<<<<<<<<
 * from _pywrapfst import EncodeMapper
 * from _pywrapfst import SymbolTable
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Arc);
  __Pyx_GIVEREF(__pyx_n_s_Arc);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Arc);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Arc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Arc, __pyx_t_1) < 0) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2507
 * 
 * from _pywrapfst import Arc
 * from _pywrapfst import EncodeMapper             # <<<<<<<<<<<<<<
 * from _pywrapfst import SymbolTable
 * from _pywrapfst import SymbolTableView
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_EncodeMapper);
  __Pyx_GIVEREF(__pyx_n_s_EncodeMapper);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_EncodeMapper);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_EncodeMapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodeMapper, __pyx_t_3) < 0) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2508
 * from _pywrapfst import Arc
 * from _pywrapfst import EncodeMapper
 * from _pywrapfst import SymbolTable             # <<<<<<<<<<<<<<
 * from _pywrapfst import SymbolTableView
 * from _pywrapfst import Weight
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_SymbolTable);
  __Pyx_GIVEREF(__pyx_n_s_SymbolTable);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SymbolTable);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SymbolTable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolTable, __pyx_t_1) < 0) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2509
 * from _pywrapfst import EncodeMapper
 * from _pywrapfst import SymbolTable
 * from _pywrapfst import SymbolTableView             # <<<<<<<<<<<<<<
 * from _pywrapfst import Weight
 * from _pywrapfst import _ArcIterator
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_SymbolTableView);
  __Pyx_GIVEREF(__pyx_n_s_SymbolTableView);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_SymbolTableView);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SymbolTableView); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolTableView, __pyx_t_3) < 0) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2510
 * from _pywrapfst import SymbolTable
 * from _pywrapfst import SymbolTableView
 * from _pywrapfst import Weight             # <<<<<<<<<<<<<<
 * from _pywrapfst import _ArcIterator
 * from _pywrapfst import _MutableArcIterator
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Weight);
  __Pyx_GIVEREF(__pyx_n_s_Weight);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Weight);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Weight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Weight, __pyx_t_1) < 0) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2511
 * from _pywrapfst import SymbolTableView
 * from _pywrapfst import Weight
 * from _pywrapfst import _ArcIterator             # <<<<<<<<<<<<<<
 * from _pywrapfst import _MutableArcIterator
 * from _pywrapfst import _StateIterator
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ArcIterator);
  __Pyx_GIVEREF(__pyx_n_s_ArcIterator);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ArcIterator);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ArcIterator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ArcIterator, __pyx_t_3) < 0) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2512
 * from _pywrapfst import Weight
 * from _pywrapfst import _ArcIterator
 * from _pywrapfst import _MutableArcIterator             # <<<<<<<<<<<<<<
 * from _pywrapfst import _StateIterator
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_MutableArcIterator);
  __Pyx_GIVEREF(__pyx_n_s_MutableArcIterator);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MutableArcIterator);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_MutableArcIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableArcIterator, __pyx_t_1) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2513
 * from _pywrapfst import _ArcIterator
 * from _pywrapfst import _MutableArcIterator
 * from _pywrapfst import _StateIterator             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_StateIterator);
  __Pyx_GIVEREF(__pyx_n_s_StateIterator);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_StateIterator);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_StateIterator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_StateIterator, __pyx_t_3) < 0) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2519
 * 
 * 
 * from _pywrapfst import FstBadWeightError             # <<<<<<<<<<<<<<
 * from _pywrapfst import FstIndexError
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FstBadWeightError);
  __Pyx_GIVEREF(__pyx_n_s_FstBadWeightError);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FstBadWeightError);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_FstBadWeightError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstBadWeightError, __pyx_t_1) < 0) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2520
 * 
 * from _pywrapfst import FstBadWeightError
 * from _pywrapfst import FstIndexError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_FstIndexError);
  __Pyx_GIVEREF(__pyx_n_s_FstIndexError);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_FstIndexError);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_FstIndexError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstIndexError, __pyx_t_3) < 0) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2526
 * 
 * 
 * from _pywrapfst import NO_LABEL             # <<<<<<<<<<<<<<
 * from _pywrapfst import NO_STATE_ID
 * from _pywrapfst import NO_SYMBOL
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NO_LABEL);
  __Pyx_GIVEREF(__pyx_n_s_NO_LABEL);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NO_LABEL);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NO_LABEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_LABEL, __pyx_t_1) < 0) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2527
 * 
 * from _pywrapfst import NO_LABEL
 * from _pywrapfst import NO_STATE_ID             # <<<<<<<<<<<<<<
 * from _pywrapfst import NO_SYMBOL
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NO_STATE_ID);
  __Pyx_GIVEREF(__pyx_n_s_NO_STATE_ID);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NO_STATE_ID);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NO_STATE_ID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_STATE_ID, __pyx_t_3) < 0) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2528
 * from _pywrapfst import NO_LABEL
 * from _pywrapfst import NO_STATE_ID
 * from _pywrapfst import NO_SYMBOL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NO_SYMBOL);
  __Pyx_GIVEREF(__pyx_n_s_NO_SYMBOL);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NO_SYMBOL);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NO_SYMBOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_SYMBOL, __pyx_t_1) < 0) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2534
 * 
 * 
 * from _pywrapfst import ACCEPTOR             # <<<<<<<<<<<<<<
 * from _pywrapfst import ACCESSIBLE
 * from _pywrapfst import ACYCLIC
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ACCEPTOR);
  __Pyx_GIVEREF(__pyx_n_s_ACCEPTOR);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ACCEPTOR);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ACCEPTOR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACCEPTOR, __pyx_t_3) < 0) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2535
 * 
 * from _pywrapfst import ACCEPTOR
 * from _pywrapfst import ACCESSIBLE             # <<<<<<<<<<<<<<
 * from _pywrapfst import ACYCLIC
 * from _pywrapfst import ADD_ARC_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ACCESSIBLE);
  __Pyx_GIVEREF(__pyx_n_s_ACCESSIBLE);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ACCESSIBLE);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ACCESSIBLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2535, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2536
 * from _pywrapfst import ACCEPTOR
 * from _pywrapfst import ACCESSIBLE
 * from _pywrapfst import ACYCLIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import ADD_ARC_PROPERTIES
 * from _pywrapfst import ADD_STATE_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ACYCLIC);
  __Pyx_GIVEREF(__pyx_n_s_ACYCLIC);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ACYCLIC);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ACYCLIC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ACYCLIC, __pyx_t_3) < 0) __PYX_ERR(0, 2536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2537
 * from _pywrapfst import ACCESSIBLE
 * from _pywrapfst import ACYCLIC
 * from _pywrapfst import ADD_ARC_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import ADD_STATE_PROPERTIES
 * from _pywrapfst import ADD_SUPERFINAL_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ADD_ARC_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_ADD_ARC_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ADD_ARC_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ADD_ARC_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2538
 * from _pywrapfst import ACYCLIC
 * from _pywrapfst import ADD_ARC_PROPERTIES
 * from _pywrapfst import ADD_STATE_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import ADD_SUPERFINAL_PROPERTIES
 * from _pywrapfst import ARC_SORT_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ADD_STATE_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_ADD_STATE_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ADD_STATE_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ADD_STATE_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_STATE_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2539
 * from _pywrapfst import ADD_ARC_PROPERTIES
 * from _pywrapfst import ADD_STATE_PROPERTIES
 * from _pywrapfst import ADD_SUPERFINAL_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_SORT_PROPERTIES
 * from _pywrapfst import BINARY_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ADD_SUPERFINAL_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_ADD_SUPERFINAL_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ADD_SUPERFINAL_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ADD_SUPERFINAL_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADD_SUPERFINAL_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2540
 * from _pywrapfst import ADD_STATE_PROPERTIES
 * from _pywrapfst import ADD_SUPERFINAL_PROPERTIES
 * from _pywrapfst import ARC_SORT_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import BINARY_PROPERTIES
 * from _pywrapfst import COACCESSIBLE
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ARC_SORT_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_ARC_SORT_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ARC_SORT_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ARC_SORT_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_SORT_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2541
 * from _pywrapfst import ADD_SUPERFINAL_PROPERTIES
 * from _pywrapfst import ARC_SORT_PROPERTIES
 * from _pywrapfst import BINARY_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import COACCESSIBLE
 * from _pywrapfst import COPY_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_BINARY_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_BINARY_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BINARY_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_BINARY_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2542
 * from _pywrapfst import ARC_SORT_PROPERTIES
 * from _pywrapfst import BINARY_PROPERTIES
 * from _pywrapfst import COACCESSIBLE             # <<<<<<<<<<<<<<
 * from _pywrapfst import COPY_PROPERTIES
 * from _pywrapfst import CYCLIC
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_COACCESSIBLE);
  __Pyx_GIVEREF(__pyx_n_s_COACCESSIBLE);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_COACCESSIBLE);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_COACCESSIBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COACCESSIBLE, __pyx_t_3) < 0) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2543
 * from _pywrapfst import BINARY_PROPERTIES
 * from _pywrapfst import COACCESSIBLE
 * from _pywrapfst import COPY_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import CYCLIC
 * from _pywrapfst import DELETE_ARC_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_COPY_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_COPY_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_COPY_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_COPY_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COPY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2544
 * from _pywrapfst import COACCESSIBLE
 * from _pywrapfst import COPY_PROPERTIES
 * from _pywrapfst import CYCLIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import DELETE_ARC_PROPERTIES
 * from _pywrapfst import DELETE_STATE_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_CYCLIC);
  __Pyx_GIVEREF(__pyx_n_s_CYCLIC);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_CYCLIC);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CYCLIC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CYCLIC, __pyx_t_3) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2545
 * from _pywrapfst import COPY_PROPERTIES
 * from _pywrapfst import CYCLIC
 * from _pywrapfst import DELETE_ARC_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import DELETE_STATE_PROPERTIES
 * from _pywrapfst import EPSILONS
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_DELETE_ARC_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_DELETE_ARC_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_DELETE_ARC_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DELETE_ARC_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DELETE_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2546
 * from _pywrapfst import CYCLIC
 * from _pywrapfst import DELETE_ARC_PROPERTIES
 * from _pywrapfst import DELETE_STATE_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import EPSILONS
 * from _pywrapfst import ERROR
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_DELETE_STATE_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_DELETE_STATE_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_DELETE_STATE_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DELETE_STATE_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DELETE_STATE_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2547
 * from _pywrapfst import DELETE_ARC_PROPERTIES
 * from _pywrapfst import DELETE_STATE_PROPERTIES
 * from _pywrapfst import EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import ERROR
 * from _pywrapfst import EXPANDED
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_EPSILONS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_EPSILONS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_EPSILONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2548
 * from _pywrapfst import DELETE_STATE_PROPERTIES
 * from _pywrapfst import EPSILONS
 * from _pywrapfst import ERROR             # <<<<<<<<<<<<<<
 * from _pywrapfst import EXPANDED
 * from _pywrapfst import EXTRINSIC_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ERROR);
  __Pyx_GIVEREF(__pyx_n_s_ERROR);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ERROR);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ERROR, __pyx_t_3) < 0) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2549
 * from _pywrapfst import EPSILONS
 * from _pywrapfst import ERROR
 * from _pywrapfst import EXPANDED             # <<<<<<<<<<<<<<
 * from _pywrapfst import EXTRINSIC_PROPERTIES
 * from _pywrapfst import FST_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_EXPANDED);
  __Pyx_GIVEREF(__pyx_n_s_EXPANDED);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_EXPANDED);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_EXPANDED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EXPANDED, __pyx_t_1) < 0) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2550
 * from _pywrapfst import ERROR
 * from _pywrapfst import EXPANDED
 * from _pywrapfst import EXTRINSIC_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import FST_PROPERTIES
 * from _pywrapfst import FstProperties
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_EXTRINSIC_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_EXTRINSIC_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_EXTRINSIC_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_EXTRINSIC_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EXTRINSIC_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2551
 * from _pywrapfst import EXPANDED
 * from _pywrapfst import EXTRINSIC_PROPERTIES
 * from _pywrapfst import FST_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import FstProperties
 * from _pywrapfst import INITIAL_ACYCLIC
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FST_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_FST_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FST_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_FST_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FST_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2552
 * from _pywrapfst import EXTRINSIC_PROPERTIES
 * from _pywrapfst import FST_PROPERTIES
 * from _pywrapfst import FstProperties             # <<<<<<<<<<<<<<
 * from _pywrapfst import INITIAL_ACYCLIC
 * from _pywrapfst import INITIAL_CYCLIC
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_FstProperties);
  __Pyx_GIVEREF(__pyx_n_s_FstProperties);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_FstProperties);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_FstProperties); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstProperties, __pyx_t_3) < 0) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2553
 * from _pywrapfst import FST_PROPERTIES
 * from _pywrapfst import FstProperties
 * from _pywrapfst import INITIAL_ACYCLIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import INITIAL_CYCLIC
 * from _pywrapfst import INTRINSIC_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_INITIAL_ACYCLIC);
  __Pyx_GIVEREF(__pyx_n_s_INITIAL_ACYCLIC);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_INITIAL_ACYCLIC);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_INITIAL_ACYCLIC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_INITIAL_ACYCLIC, __pyx_t_1) < 0) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2554
 * from _pywrapfst import FstProperties
 * from _pywrapfst import INITIAL_ACYCLIC
 * from _pywrapfst import INITIAL_CYCLIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import INTRINSIC_PROPERTIES
 * from _pywrapfst import I_DETERMINISTIC
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_INITIAL_CYCLIC);
  __Pyx_GIVEREF(__pyx_n_s_INITIAL_CYCLIC);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_INITIAL_CYCLIC);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_INITIAL_CYCLIC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_INITIAL_CYCLIC, __pyx_t_3) < 0) __PYX_ERR(0, 2554, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2555
 * from _pywrapfst import INITIAL_ACYCLIC
 * from _pywrapfst import INITIAL_CYCLIC
 * from _pywrapfst import INTRINSIC_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import I_DETERMINISTIC
 * from _pywrapfst import I_EPSILONS
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_INTRINSIC_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_INTRINSIC_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_INTRINSIC_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_INTRINSIC_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_INTRINSIC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2556
 * from _pywrapfst import INITIAL_CYCLIC
 * from _pywrapfst import INTRINSIC_PROPERTIES
 * from _pywrapfst import I_DETERMINISTIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import I_EPSILONS
 * from _pywrapfst import I_LABEL_INVARIANT_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_I_DETERMINISTIC);
  __Pyx_GIVEREF(__pyx_n_s_I_DETERMINISTIC);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_I_DETERMINISTIC);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_I_DETERMINISTIC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_DETERMINISTIC, __pyx_t_3) < 0) __PYX_ERR(0, 2556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2557
 * from _pywrapfst import INTRINSIC_PROPERTIES
 * from _pywrapfst import I_DETERMINISTIC
 * from _pywrapfst import I_EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import I_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import I_LABEL_SORTED
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_I_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_I_EPSILONS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_I_EPSILONS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_I_EPSILONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2558
 * from _pywrapfst import I_DETERMINISTIC
 * from _pywrapfst import I_EPSILONS
 * from _pywrapfst import I_LABEL_INVARIANT_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import I_LABEL_SORTED
 * from _pywrapfst import MUTABLE
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_I_LABEL_INVARIANT_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_I_LABEL_INVARIANT_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_I_LABEL_INVARIANT_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_LABEL_INVARIANT_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2559
 * from _pywrapfst import I_EPSILONS
 * from _pywrapfst import I_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import I_LABEL_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import MUTABLE
 * from _pywrapfst import NEG_TRINARY_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_I_LABEL_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_I_LABEL_SORTED);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_I_LABEL_SORTED);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_I_LABEL_SORTED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_I_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2560
 * from _pywrapfst import I_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import I_LABEL_SORTED
 * from _pywrapfst import MUTABLE             # <<<<<<<<<<<<<<
 * from _pywrapfst import NEG_TRINARY_PROPERTIES
 * from _pywrapfst import NON_I_DETERMINISTIC
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_MUTABLE);
  __Pyx_GIVEREF(__pyx_n_s_MUTABLE);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_MUTABLE);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_MUTABLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MUTABLE, __pyx_t_3) < 0) __PYX_ERR(0, 2560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2561
 * from _pywrapfst import I_LABEL_SORTED
 * from _pywrapfst import MUTABLE
 * from _pywrapfst import NEG_TRINARY_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import NON_I_DETERMINISTIC
 * from _pywrapfst import NON_O_DETERMINISTIC
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NEG_TRINARY_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_NEG_TRINARY_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NEG_TRINARY_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NEG_TRINARY_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NEG_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2562
 * from _pywrapfst import MUTABLE
 * from _pywrapfst import NEG_TRINARY_PROPERTIES
 * from _pywrapfst import NON_I_DETERMINISTIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import NON_O_DETERMINISTIC
 * from _pywrapfst import NOT_ACCEPTOR
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NON_I_DETERMINISTIC);
  __Pyx_GIVEREF(__pyx_n_s_NON_I_DETERMINISTIC);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NON_I_DETERMINISTIC);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NON_I_DETERMINISTIC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NON_I_DETERMINISTIC, __pyx_t_3) < 0) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2563
 * from _pywrapfst import NEG_TRINARY_PROPERTIES
 * from _pywrapfst import NON_I_DETERMINISTIC
 * from _pywrapfst import NON_O_DETERMINISTIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_ACCEPTOR
 * from _pywrapfst import NOT_ACCESSIBLE
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NON_O_DETERMINISTIC);
  __Pyx_GIVEREF(__pyx_n_s_NON_O_DETERMINISTIC);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NON_O_DETERMINISTIC);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NON_O_DETERMINISTIC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NON_O_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2564
 * from _pywrapfst import NON_I_DETERMINISTIC
 * from _pywrapfst import NON_O_DETERMINISTIC
 * from _pywrapfst import NOT_ACCEPTOR             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_ACCESSIBLE
 * from _pywrapfst import NOT_COACCESSIBLE
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NOT_ACCEPTOR);
  __Pyx_GIVEREF(__pyx_n_s_NOT_ACCEPTOR);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NOT_ACCEPTOR);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NOT_ACCEPTOR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_ACCEPTOR, __pyx_t_3) < 0) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2565
 * from _pywrapfst import NON_O_DETERMINISTIC
 * from _pywrapfst import NOT_ACCEPTOR
 * from _pywrapfst import NOT_ACCESSIBLE             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_COACCESSIBLE
 * from _pywrapfst import NOT_I_LABEL_SORTED
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NOT_ACCESSIBLE);
  __Pyx_GIVEREF(__pyx_n_s_NOT_ACCESSIBLE);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NOT_ACCESSIBLE);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NOT_ACCESSIBLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_ACCESSIBLE, __pyx_t_1) < 0) __PYX_ERR(0, 2565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2566
 * from _pywrapfst import NOT_ACCEPTOR
 * from _pywrapfst import NOT_ACCESSIBLE
 * from _pywrapfst import NOT_COACCESSIBLE             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_I_LABEL_SORTED
 * from _pywrapfst import NOT_O_LABEL_SORTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NOT_COACCESSIBLE);
  __Pyx_GIVEREF(__pyx_n_s_NOT_COACCESSIBLE);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NOT_COACCESSIBLE);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NOT_COACCESSIBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_COACCESSIBLE, __pyx_t_3) < 0) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2567
 * from _pywrapfst import NOT_ACCESSIBLE
 * from _pywrapfst import NOT_COACCESSIBLE
 * from _pywrapfst import NOT_I_LABEL_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_O_LABEL_SORTED
 * from _pywrapfst import NOT_STRING
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NOT_I_LABEL_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_NOT_I_LABEL_SORTED);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NOT_I_LABEL_SORTED);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NOT_I_LABEL_SORTED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_I_LABEL_SORTED, __pyx_t_1) < 0) __PYX_ERR(0, 2567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2568
 * from _pywrapfst import NOT_COACCESSIBLE
 * from _pywrapfst import NOT_I_LABEL_SORTED
 * from _pywrapfst import NOT_O_LABEL_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_STRING
 * from _pywrapfst import NOT_TOP_SORTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NOT_O_LABEL_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_NOT_O_LABEL_SORTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NOT_O_LABEL_SORTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NOT_O_LABEL_SORTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_O_LABEL_SORTED, __pyx_t_3) < 0) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2569
 * from _pywrapfst import NOT_I_LABEL_SORTED
 * from _pywrapfst import NOT_O_LABEL_SORTED
 * from _pywrapfst import NOT_STRING             # <<<<<<<<<<<<<<
 * from _pywrapfst import NOT_TOP_SORTED
 * from _pywrapfst import NO_EPSILONS
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NOT_STRING);
  __Pyx_GIVEREF(__pyx_n_s_NOT_STRING);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NOT_STRING);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NOT_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_STRING, __pyx_t_1) < 0) __PYX_ERR(0, 2569, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2570
 * from _pywrapfst import NOT_O_LABEL_SORTED
 * from _pywrapfst import NOT_STRING
 * from _pywrapfst import NOT_TOP_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import NO_EPSILONS
 * from _pywrapfst import NO_I_EPSILONS
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NOT_TOP_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_NOT_TOP_SORTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NOT_TOP_SORTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NOT_TOP_SORTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_TOP_SORTED, __pyx_t_3) < 0) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2571
 * from _pywrapfst import NOT_STRING
 * from _pywrapfst import NOT_TOP_SORTED
 * from _pywrapfst import NO_EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import NO_I_EPSILONS
 * from _pywrapfst import NO_O_EPSILONS
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NO_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_NO_EPSILONS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NO_EPSILONS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NO_EPSILONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2572
 * from _pywrapfst import NOT_TOP_SORTED
 * from _pywrapfst import NO_EPSILONS
 * from _pywrapfst import NO_I_EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import NO_O_EPSILONS
 * from _pywrapfst import NULL_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NO_I_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_NO_I_EPSILONS);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NO_I_EPSILONS);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NO_I_EPSILONS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_I_EPSILONS, __pyx_t_3) < 0) __PYX_ERR(0, 2572, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2573
 * from _pywrapfst import NO_EPSILONS
 * from _pywrapfst import NO_I_EPSILONS
 * from _pywrapfst import NO_O_EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import NULL_PROPERTIES
 * from _pywrapfst import O_DETERMINISTIC
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NO_O_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_NO_O_EPSILONS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NO_O_EPSILONS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_NO_O_EPSILONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_O_EPSILONS, __pyx_t_1) < 0) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2574
 * from _pywrapfst import NO_I_EPSILONS
 * from _pywrapfst import NO_O_EPSILONS
 * from _pywrapfst import NULL_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import O_DETERMINISTIC
 * from _pywrapfst import O_EPSILONS
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_NULL_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_NULL_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_NULL_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NULL_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NULL_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2575
 * from _pywrapfst import NO_O_EPSILONS
 * from _pywrapfst import NULL_PROPERTIES
 * from _pywrapfst import O_DETERMINISTIC             # <<<<<<<<<<<<<<
 * from _pywrapfst import O_EPSILONS
 * from _pywrapfst import O_LABEL_INVARIANT_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_O_DETERMINISTIC);
  __Pyx_GIVEREF(__pyx_n_s_O_DETERMINISTIC);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_O_DETERMINISTIC);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_O_DETERMINISTIC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_DETERMINISTIC, __pyx_t_1) < 0) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2576
 * from _pywrapfst import NULL_PROPERTIES
 * from _pywrapfst import O_DETERMINISTIC
 * from _pywrapfst import O_EPSILONS             # <<<<<<<<<<<<<<
 * from _pywrapfst import O_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import O_LABEL_SORTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_O_EPSILONS);
  __Pyx_GIVEREF(__pyx_n_s_O_EPSILONS);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_O_EPSILONS);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_O_EPSILONS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_EPSILONS, __pyx_t_3) < 0) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2577
 * from _pywrapfst import O_DETERMINISTIC
 * from _pywrapfst import O_EPSILONS
 * from _pywrapfst import O_LABEL_INVARIANT_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import O_LABEL_SORTED
 * from _pywrapfst import POS_TRINARY_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_O_LABEL_INVARIANT_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_O_LABEL_INVARIANT_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_O_LABEL_INVARIANT_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_LABEL_INVARIANT_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2578
 * from _pywrapfst import O_EPSILONS
 * from _pywrapfst import O_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import O_LABEL_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import POS_TRINARY_PROPERTIES
 * from _pywrapfst import RM_SUPERFINAL_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_O_LABEL_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_O_LABEL_SORTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_O_LABEL_SORTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_O_LABEL_SORTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_O_LABEL_SORTED, __pyx_t_3) < 0) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2579
 * from _pywrapfst import O_LABEL_INVARIANT_PROPERTIES
 * from _pywrapfst import O_LABEL_SORTED
 * from _pywrapfst import POS_TRINARY_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import RM_SUPERFINAL_PROPERTIES
 * from _pywrapfst import SET_ARC_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_POS_TRINARY_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_POS_TRINARY_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_POS_TRINARY_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_POS_TRINARY_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_POS_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2579, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2580
 * from _pywrapfst import O_LABEL_SORTED
 * from _pywrapfst import POS_TRINARY_PROPERTIES
 * from _pywrapfst import RM_SUPERFINAL_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import SET_ARC_PROPERTIES
 * from _pywrapfst import SET_FINAL_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_RM_SUPERFINAL_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_RM_SUPERFINAL_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_RM_SUPERFINAL_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RM_SUPERFINAL_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RM_SUPERFINAL_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2580, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2581
 * from _pywrapfst import POS_TRINARY_PROPERTIES
 * from _pywrapfst import RM_SUPERFINAL_PROPERTIES
 * from _pywrapfst import SET_ARC_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import SET_FINAL_PROPERTIES
 * from _pywrapfst import SET_START_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_SET_ARC_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_SET_ARC_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SET_ARC_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SET_ARC_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_ARC_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2582
 * from _pywrapfst import RM_SUPERFINAL_PROPERTIES
 * from _pywrapfst import SET_ARC_PROPERTIES
 * from _pywrapfst import SET_FINAL_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import SET_START_PROPERTIES
 * from _pywrapfst import STATE_SORT_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_SET_FINAL_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_SET_FINAL_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_SET_FINAL_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SET_FINAL_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_FINAL_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2582, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2583
 * from _pywrapfst import SET_ARC_PROPERTIES
 * from _pywrapfst import SET_FINAL_PROPERTIES
 * from _pywrapfst import SET_START_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import STATE_SORT_PROPERTIES
 * from _pywrapfst import STRING
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_SET_START_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_SET_START_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SET_START_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SET_START_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SET_START_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2583, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2584
 * from _pywrapfst import SET_FINAL_PROPERTIES
 * from _pywrapfst import SET_START_PROPERTIES
 * from _pywrapfst import STATE_SORT_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import STRING
 * from _pywrapfst import TOP_SORTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_STATE_SORT_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_STATE_SORT_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_STATE_SORT_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_STATE_SORT_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATE_SORT_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2585
 * from _pywrapfst import SET_START_PROPERTIES
 * from _pywrapfst import STATE_SORT_PROPERTIES
 * from _pywrapfst import STRING             # <<<<<<<<<<<<<<
 * from _pywrapfst import TOP_SORTED
 * from _pywrapfst import TRINARY_PROPERTIES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_STRING);
  __Pyx_GIVEREF(__pyx_n_s_STRING);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_STRING);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_STRING, __pyx_t_1) < 0) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2586
 * from _pywrapfst import STATE_SORT_PROPERTIES
 * from _pywrapfst import STRING
 * from _pywrapfst import TOP_SORTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import TRINARY_PROPERTIES
 * from _pywrapfst import UNWEIGHTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_TOP_SORTED);
  __Pyx_GIVEREF(__pyx_n_s_TOP_SORTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_TOP_SORTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_TOP_SORTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TOP_SORTED, __pyx_t_3) < 0) __PYX_ERR(0, 2586, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2587
 * from _pywrapfst import STRING
 * from _pywrapfst import TOP_SORTED
 * from _pywrapfst import TRINARY_PROPERTIES             # <<<<<<<<<<<<<<
 * from _pywrapfst import UNWEIGHTED
 * from _pywrapfst import UNWEIGHTED_CYCLES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_TRINARY_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_TRINARY_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_TRINARY_PROPERTIES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_TRINARY_PROPERTIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TRINARY_PROPERTIES, __pyx_t_1) < 0) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2588
 * from _pywrapfst import TOP_SORTED
 * from _pywrapfst import TRINARY_PROPERTIES
 * from _pywrapfst import UNWEIGHTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import UNWEIGHTED_CYCLES
 * from _pywrapfst import WEIGHTED
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_UNWEIGHTED);
  __Pyx_GIVEREF(__pyx_n_s_UNWEIGHTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_UNWEIGHTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_UNWEIGHTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNWEIGHTED, __pyx_t_3) < 0) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2589
 * from _pywrapfst import TRINARY_PROPERTIES
 * from _pywrapfst import UNWEIGHTED
 * from _pywrapfst import UNWEIGHTED_CYCLES             # <<<<<<<<<<<<<<
 * from _pywrapfst import WEIGHTED
 * from _pywrapfst import WEIGHTED_CYCLES
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_UNWEIGHTED_CYCLES);
  __Pyx_GIVEREF(__pyx_n_s_UNWEIGHTED_CYCLES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_UNWEIGHTED_CYCLES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_UNWEIGHTED_CYCLES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNWEIGHTED_CYCLES, __pyx_t_1) < 0) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2590
 * from _pywrapfst import UNWEIGHTED
 * from _pywrapfst import UNWEIGHTED_CYCLES
 * from _pywrapfst import WEIGHTED             # <<<<<<<<<<<<<<
 * from _pywrapfst import WEIGHTED_CYCLES
 * from _pywrapfst import WEIGHT_INVARIANT_PROPERTIES
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_WEIGHTED);
  __Pyx_GIVEREF(__pyx_n_s_WEIGHTED);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_WEIGHTED);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_WEIGHTED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHTED, __pyx_t_3) < 0) __PYX_ERR(0, 2590, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2591
 * from _pywrapfst import UNWEIGHTED_CYCLES
 * from _pywrapfst import WEIGHTED
 * from _pywrapfst import WEIGHTED_CYCLES             # <<<<<<<<<<<<<<
 * from _pywrapfst import WEIGHT_INVARIANT_PROPERTIES
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_WEIGHTED_CYCLES);
  __Pyx_GIVEREF(__pyx_n_s_WEIGHTED_CYCLES);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_WEIGHTED_CYCLES);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_WEIGHTED_CYCLES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHTED_CYCLES, __pyx_t_1) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2592
 * from _pywrapfst import WEIGHTED
 * from _pywrapfst import WEIGHTED_CYCLES
 * from _pywrapfst import WEIGHT_INVARIANT_PROPERTIES             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES);
  __Pyx_GIVEREF(__pyx_n_s_WEIGHT_INVARIANT_PROPERTIES);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_WEIGHT_INVARIANT_PROPERTIES);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_WEIGHT_INVARIANT_PROPERTIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WEIGHT_INVARIANT_PROPERTIES, __pyx_t_3) < 0) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2598
 * 
 * 
 * from _pywrapfst import ARC_FLAGS             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_I_LABEL_VALUE
 * from _pywrapfst import ARC_NEXT_STATE_VALUE
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ARC_FLAGS);
  __Pyx_GIVEREF(__pyx_n_s_ARC_FLAGS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ARC_FLAGS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ARC_FLAGS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_FLAGS, __pyx_t_1) < 0) __PYX_ERR(0, 2598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2599
 * 
 * from _pywrapfst import ARC_FLAGS
 * from _pywrapfst import ARC_I_LABEL_VALUE             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_NEXT_STATE_VALUE
 * from _pywrapfst import ARC_NO_CACHE
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ARC_I_LABEL_VALUE);
  __Pyx_GIVEREF(__pyx_n_s_ARC_I_LABEL_VALUE);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ARC_I_LABEL_VALUE);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ARC_I_LABEL_VALUE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_I_LABEL_VALUE, __pyx_t_3) < 0) __PYX_ERR(0, 2599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2600
 * from _pywrapfst import ARC_FLAGS
 * from _pywrapfst import ARC_I_LABEL_VALUE
 * from _pywrapfst import ARC_NEXT_STATE_VALUE             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_NO_CACHE
 * from _pywrapfst import ARC_O_LABEL_VALUE
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ARC_NEXT_STATE_VALUE);
  __Pyx_GIVEREF(__pyx_n_s_ARC_NEXT_STATE_VALUE);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ARC_NEXT_STATE_VALUE);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ARC_NEXT_STATE_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_NEXT_STATE_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2601
 * from _pywrapfst import ARC_I_LABEL_VALUE
 * from _pywrapfst import ARC_NEXT_STATE_VALUE
 * from _pywrapfst import ARC_NO_CACHE             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_O_LABEL_VALUE
 * from _pywrapfst import ARC_VALUE_FLAGS
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ARC_NO_CACHE);
  __Pyx_GIVEREF(__pyx_n_s_ARC_NO_CACHE);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ARC_NO_CACHE);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ARC_NO_CACHE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_NO_CACHE, __pyx_t_3) < 0) __PYX_ERR(0, 2601, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2602
 * from _pywrapfst import ARC_NEXT_STATE_VALUE
 * from _pywrapfst import ARC_NO_CACHE
 * from _pywrapfst import ARC_O_LABEL_VALUE             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_VALUE_FLAGS
 * from _pywrapfst import ARC_WEIGHT_VALUE
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ARC_O_LABEL_VALUE);
  __Pyx_GIVEREF(__pyx_n_s_ARC_O_LABEL_VALUE);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ARC_O_LABEL_VALUE);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ARC_O_LABEL_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_O_LABEL_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2603
 * from _pywrapfst import ARC_NO_CACHE
 * from _pywrapfst import ARC_O_LABEL_VALUE
 * from _pywrapfst import ARC_VALUE_FLAGS             # <<<<<<<<<<<<<<
 * from _pywrapfst import ARC_WEIGHT_VALUE
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ARC_VALUE_FLAGS);
  __Pyx_GIVEREF(__pyx_n_s_ARC_VALUE_FLAGS);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ARC_VALUE_FLAGS);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ARC_VALUE_FLAGS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_VALUE_FLAGS, __pyx_t_3) < 0) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2604
 * from _pywrapfst import ARC_O_LABEL_VALUE
 * from _pywrapfst import ARC_VALUE_FLAGS
 * from _pywrapfst import ARC_WEIGHT_VALUE             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ARC_WEIGHT_VALUE);
  __Pyx_GIVEREF(__pyx_n_s_ARC_WEIGHT_VALUE);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ARC_WEIGHT_VALUE);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ARC_WEIGHT_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ARC_WEIGHT_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2610
 * 
 * 
 * from _pywrapfst import ENCODE_FLAGS             # <<<<<<<<<<<<<<
 * from _pywrapfst import ENCODE_LABELS
 * from _pywrapfst import ENCODE_WEIGHTS
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ENCODE_FLAGS);
  __Pyx_GIVEREF(__pyx_n_s_ENCODE_FLAGS);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ENCODE_FLAGS);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ENCODE_FLAGS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_FLAGS, __pyx_t_3) < 0) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2611
 * 
 * from _pywrapfst import ENCODE_FLAGS
 * from _pywrapfst import ENCODE_LABELS             # <<<<<<<<<<<<<<
 * from _pywrapfst import ENCODE_WEIGHTS
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ENCODE_LABELS);
  __Pyx_GIVEREF(__pyx_n_s_ENCODE_LABELS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ENCODE_LABELS);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ENCODE_LABELS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_LABELS, __pyx_t_1) < 0) __PYX_ERR(0, 2611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2612
 * from _pywrapfst import ENCODE_FLAGS
 * from _pywrapfst import ENCODE_LABELS
 * from _pywrapfst import ENCODE_WEIGHTS             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ENCODE_WEIGHTS);
  __Pyx_GIVEREF(__pyx_n_s_ENCODE_WEIGHTS);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ENCODE_WEIGHTS);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ENCODE_WEIGHTS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENCODE_WEIGHTS, __pyx_t_3) < 0) __PYX_ERR(0, 2612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2621
 * 
 * 
 * def _copy_patch(fnc):             # <<<<<<<<<<<<<<
 *   @functools.wraps(fnc)
 *   def patch(arg1, *args, **kwargs):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_55_copy_patch, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy_patch, __pyx_t_1) < 0) __PYX_ERR(0, 2621, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2630
 * 
 * 
 * arcsort = _copy_patch(Fst.arcsort)             # <<<<<<<<<<<<<<
 * closure = _copy_patch(Fst.closure)
 * connect = _copy_patch(Fst.connect)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_arcsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_arcsort, __pyx_t_2) < 0) __PYX_ERR(0, 2630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2631
 * 
 * arcsort = _copy_patch(Fst.arcsort)
 * closure = _copy_patch(Fst.closure)             # <<<<<<<<<<<<<<
 * connect = _copy_patch(Fst.connect)
 * decode = _copy_patch(Fst.decode)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_closure); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2631, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_closure, __pyx_t_1) < 0) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2632
 * arcsort = _copy_patch(Fst.arcsort)
 * closure = _copy_patch(Fst.closure)
 * connect = _copy_patch(Fst.connect)             # <<<<<<<<<<<<<<
 * decode = _copy_patch(Fst.decode)
 * encode = _copy_patch(Fst.encode)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_connect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_connect, __pyx_t_2) < 0) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2633
 * closure = _copy_patch(Fst.closure)
 * connect = _copy_patch(Fst.connect)
 * decode = _copy_patch(Fst.decode)             # <<<<<<<<<<<<<<
 * encode = _copy_patch(Fst.encode)
 * invert = _copy_patch(Fst.invert)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2633, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode, __pyx_t_1) < 0) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2634
 * connect = _copy_patch(Fst.connect)
 * decode = _copy_patch(Fst.decode)
 * encode = _copy_patch(Fst.encode)             # <<<<<<<<<<<<<<
 * invert = _copy_patch(Fst.invert)
 * minimize = _copy_patch(Fst.minimize)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode, __pyx_t_2) < 0) __PYX_ERR(0, 2634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2635
 * decode = _copy_patch(Fst.decode)
 * encode = _copy_patch(Fst.encode)
 * invert = _copy_patch(Fst.invert)             # <<<<<<<<<<<<<<
 * minimize = _copy_patch(Fst.minimize)
 * optimize = _copy_patch(Fst.optimize)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_invert); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2635, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_invert, __pyx_t_1) < 0) __PYX_ERR(0, 2635, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2636
 * encode = _copy_patch(Fst.encode)
 * invert = _copy_patch(Fst.invert)
 * minimize = _copy_patch(Fst.minimize)             # <<<<<<<<<<<<<<
 * optimize = _copy_patch(Fst.optimize)
 * project = _copy_patch(Fst.project)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_minimize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_minimize, __pyx_t_2) < 0) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2637
 * invert = _copy_patch(Fst.invert)
 * minimize = _copy_patch(Fst.minimize)
 * optimize = _copy_patch(Fst.optimize)             # <<<<<<<<<<<<<<
 * project = _copy_patch(Fst.project)
 * relabel_pairs = _copy_patch(Fst.relabel_pairs)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_optimize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_optimize, __pyx_t_1) < 0) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2638
 * minimize = _copy_patch(Fst.minimize)
 * optimize = _copy_patch(Fst.optimize)
 * project = _copy_patch(Fst.project)             # <<<<<<<<<<<<<<
 * relabel_pairs = _copy_patch(Fst.relabel_pairs)
 * relabel_tables = _copy_patch(Fst.relabel_tables)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_project); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_project, __pyx_t_2) < 0) __PYX_ERR(0, 2638, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2639
 * optimize = _copy_patch(Fst.optimize)
 * project = _copy_patch(Fst.project)
 * relabel_pairs = _copy_patch(Fst.relabel_pairs)             # <<<<<<<<<<<<<<
 * relabel_tables = _copy_patch(Fst.relabel_tables)
 * reweight = _copy_patch(Fst.reweight)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_relabel_pairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2639, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_relabel_pairs, __pyx_t_1) < 0) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2640
 * project = _copy_patch(Fst.project)
 * relabel_pairs = _copy_patch(Fst.relabel_pairs)
 * relabel_tables = _copy_patch(Fst.relabel_tables)             # <<<<<<<<<<<<<<
 * reweight = _copy_patch(Fst.reweight)
 * rmepsilon = _copy_patch(Fst.rmepsilon)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_relabel_tables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_relabel_tables, __pyx_t_2) < 0) __PYX_ERR(0, 2640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2641
 * relabel_pairs = _copy_patch(Fst.relabel_pairs)
 * relabel_tables = _copy_patch(Fst.relabel_tables)
 * reweight = _copy_patch(Fst.reweight)             # <<<<<<<<<<<<<<
 * rmepsilon = _copy_patch(Fst.rmepsilon)
 * topsort = _copy_patch(Fst.topsort)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_reweight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2641, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reweight, __pyx_t_1) < 0) __PYX_ERR(0, 2641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2642
 * relabel_tables = _copy_patch(Fst.relabel_tables)
 * reweight = _copy_patch(Fst.reweight)
 * rmepsilon = _copy_patch(Fst.rmepsilon)             # <<<<<<<<<<<<<<
 * topsort = _copy_patch(Fst.topsort)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_rmepsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rmepsilon, __pyx_t_2) < 0) __PYX_ERR(0, 2642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_pynini.pyx":2643
 * reweight = _copy_patch(Fst.reweight)
 * rmepsilon = _copy_patch(Fst.rmepsilon)
 * topsort = _copy_patch(Fst.topsort)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_copy_patch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7_pynini_Fst), __pyx_n_s_topsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2643, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_topsort, __pyx_t_1) < 0) __PYX_ERR(0, 2643, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2649
 * 
 * 
 * from _pywrapfst import compact_symbol_table             # <<<<<<<<<<<<<<
 * from _pywrapfst import merge_symbol_table
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_compact_symbol_table);
  __Pyx_GIVEREF(__pyx_n_s_compact_symbol_table);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_compact_symbol_table);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_compact_symbol_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compact_symbol_table, __pyx_t_1) < 0) __PYX_ERR(0, 2649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2650
 * 
 * from _pywrapfst import compact_symbol_table
 * from _pywrapfst import merge_symbol_table             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_merge_symbol_table);
  __Pyx_GIVEREF(__pyx_n_s_merge_symbol_table);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_merge_symbol_table);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_merge_symbol_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_symbol_table, __pyx_t_3) < 0) __PYX_ERR(0, 2650, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2656
 * 
 * 
 * from _pywrapfst import divide             # <<<<<<<<<<<<<<
 * from _pywrapfst import power
 * from _pywrapfst import plus
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_divide);
  __Pyx_GIVEREF(__pyx_n_s_divide);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_divide);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_divide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_divide, __pyx_t_1) < 0) __PYX_ERR(0, 2656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2657
 * 
 * from _pywrapfst import divide
 * from _pywrapfst import power             # <<<<<<<<<<<<<<
 * from _pywrapfst import plus
 * from _pywrapfst import times
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_power);
  __Pyx_GIVEREF(__pyx_n_s_power);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_power);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_power); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_power, __pyx_t_3) < 0) __PYX_ERR(0, 2657, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2658
 * from _pywrapfst import divide
 * from _pywrapfst import power
 * from _pywrapfst import plus             # <<<<<<<<<<<<<<
 * from _pywrapfst import times
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_plus);
  __Pyx_GIVEREF(__pyx_n_s_plus);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_plus);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_plus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_plus, __pyx_t_1) < 0) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2659
 * from _pywrapfst import power
 * from _pywrapfst import plus
 * from _pywrapfst import times             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_times);
  __Pyx_GIVEREF(__pyx_n_s_times);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_times);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_times); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_times, __pyx_t_3) < 0) __PYX_ERR(0, 2659, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2664
 * # Custom types.
 * 
 * from _pywrapfst import ArcMapType             # <<<<<<<<<<<<<<
 * from _pywrapfst import ComposeFilter
 * from _pywrapfst import DeterminizeType
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ArcMapType);
  __Pyx_GIVEREF(__pyx_n_s_ArcMapType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ArcMapType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ArcMapType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ArcMapType, __pyx_t_1) < 0) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2665
 * 
 * from _pywrapfst import ArcMapType
 * from _pywrapfst import ComposeFilter             # <<<<<<<<<<<<<<
 * from _pywrapfst import DeterminizeType
 * from _pywrapfst import EpsNormalizeType
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ComposeFilter);
  __Pyx_GIVEREF(__pyx_n_s_ComposeFilter);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ComposeFilter);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ComposeFilter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ComposeFilter, __pyx_t_3) < 0) __PYX_ERR(0, 2665, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2666
 * from _pywrapfst import ArcMapType
 * from _pywrapfst import ComposeFilter
 * from _pywrapfst import DeterminizeType             # <<<<<<<<<<<<<<
 * from _pywrapfst import EpsNormalizeType
 * from _pywrapfst import FarType
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_DeterminizeType);
  __Pyx_GIVEREF(__pyx_n_s_DeterminizeType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_DeterminizeType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DeterminizeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DeterminizeType, __pyx_t_1) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2667
 * from _pywrapfst import ComposeFilter
 * from _pywrapfst import DeterminizeType
 * from _pywrapfst import EpsNormalizeType             # <<<<<<<<<<<<<<
 * from _pywrapfst import FarType
 * from _pywrapfst import ProjectType
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_EpsNormalizeType);
  __Pyx_GIVEREF(__pyx_n_s_EpsNormalizeType);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_EpsNormalizeType);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_EpsNormalizeType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EpsNormalizeType, __pyx_t_3) < 0) __PYX_ERR(0, 2667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2668
 * from _pywrapfst import DeterminizeType
 * from _pywrapfst import EpsNormalizeType
 * from _pywrapfst import FarType             # <<<<<<<<<<<<<<
 * from _pywrapfst import ProjectType
 * from _pywrapfst import QueueType
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FarType);
  __Pyx_GIVEREF(__pyx_n_s_FarType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FarType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_FarType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FarType, __pyx_t_1) < 0) __PYX_ERR(0, 2668, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2669
 * from _pywrapfst import EpsNormalizeType
 * from _pywrapfst import FarType
 * from _pywrapfst import ProjectType             # <<<<<<<<<<<<<<
 * from _pywrapfst import QueueType
 * from _pywrapfst import RandArcSelection
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ProjectType);
  __Pyx_GIVEREF(__pyx_n_s_ProjectType);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ProjectType);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ProjectType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProjectType, __pyx_t_3) < 0) __PYX_ERR(0, 2669, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2670
 * from _pywrapfst import FarType
 * from _pywrapfst import ProjectType
 * from _pywrapfst import QueueType             # <<<<<<<<<<<<<<
 * from _pywrapfst import RandArcSelection
 * from _pywrapfst import ReplaceLabelType
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_QueueType);
  __Pyx_GIVEREF(__pyx_n_s_QueueType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_QueueType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_QueueType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_QueueType, __pyx_t_1) < 0) __PYX_ERR(0, 2670, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2671
 * from _pywrapfst import ProjectType
 * from _pywrapfst import QueueType
 * from _pywrapfst import RandArcSelection             # <<<<<<<<<<<<<<
 * from _pywrapfst import ReplaceLabelType
 * from _pywrapfst import ReweightType
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_RandArcSelection);
  __Pyx_GIVEREF(__pyx_n_s_RandArcSelection);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_RandArcSelection);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RandArcSelection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RandArcSelection, __pyx_t_3) < 0) __PYX_ERR(0, 2671, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2672
 * from _pywrapfst import QueueType
 * from _pywrapfst import RandArcSelection
 * from _pywrapfst import ReplaceLabelType             # <<<<<<<<<<<<<<
 * from _pywrapfst import ReweightType
 * from _pywrapfst import SortType
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ReplaceLabelType);
  __Pyx_GIVEREF(__pyx_n_s_ReplaceLabelType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ReplaceLabelType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ReplaceLabelType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReplaceLabelType, __pyx_t_1) < 0) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2673
 * from _pywrapfst import RandArcSelection
 * from _pywrapfst import ReplaceLabelType
 * from _pywrapfst import ReweightType             # <<<<<<<<<<<<<<
 * from _pywrapfst import SortType
 * from _pywrapfst import StateMapType
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_ReweightType);
  __Pyx_GIVEREF(__pyx_n_s_ReweightType);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ReweightType);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ReweightType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReweightType, __pyx_t_3) < 0) __PYX_ERR(0, 2673, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2674
 * from _pywrapfst import ReplaceLabelType
 * from _pywrapfst import ReweightType
 * from _pywrapfst import SortType             # <<<<<<<<<<<<<<
 * from _pywrapfst import StateMapType
 * from _pywrapfst import WeightLike
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_SortType);
  __Pyx_GIVEREF(__pyx_n_s_SortType);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SortType);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SortType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SortType, __pyx_t_1) < 0) __PYX_ERR(0, 2674, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2675
 * from _pywrapfst import ReweightType
 * from _pywrapfst import SortType
 * from _pywrapfst import StateMapType             # <<<<<<<<<<<<<<
 * from _pywrapfst import WeightLike
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_StateMapType);
  __Pyx_GIVEREF(__pyx_n_s_StateMapType);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_StateMapType);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_StateMapType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_StateMapType, __pyx_t_3) < 0) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_pynini.pyx":2676
 * from _pywrapfst import SortType
 * from _pywrapfst import StateMapType
 * from _pywrapfst import WeightLike             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_WeightLike);
  __Pyx_GIVEREF(__pyx_n_s_WeightLike);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_WeightLike);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pywrapfst, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_WeightLike); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WeightLike, __pyx_t_1) < 0) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2683
 * 
 * 
 * import typing             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_typing, __pyx_t_3) < 0) __PYX_ERR(0, 2683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":2686
 * 
 * 
 * CDRewriteDirection = """typing.Literal["ltr", "rtl", "sim"]"""             # <<<<<<<<<<<<<<
 * CDRewriteMode = """typing.Literal["obl", "opt"]"""
 * FarFileMode = """typing.Literal["r", "w"]"""
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CDRewriteDirection, __pyx_kp_u_typing_Literal_ltr_rtl_sim) < 0) __PYX_ERR(0, 2686, __pyx_L1_error)

  /* "_pynini.pyx":2687
 * 
 * CDRewriteDirection = """typing.Literal["ltr", "rtl", "sim"]"""
 * CDRewriteMode = """typing.Literal["obl", "opt"]"""             # <<<<<<<<<<<<<<
 * FarFileMode = """typing.Literal["r", "w"]"""
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CDRewriteMode, __pyx_kp_u_typing_Literal_obl_opt) < 0) __PYX_ERR(0, 2687, __pyx_L1_error)

  /* "_pynini.pyx":2688
 * CDRewriteDirection = """typing.Literal["ltr", "rtl", "sim"]"""
 * CDRewriteMode = """typing.Literal["obl", "opt"]"""
 * FarFileMode = """typing.Literal["r", "w"]"""             # <<<<<<<<<<<<<<
 * 
 * FstLike = """typing.Union[Fst, str]"""
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FarFileMode, __pyx_kp_u_typing_Literal_r_w) < 0) __PYX_ERR(0, 2688, __pyx_L1_error)

  /* "_pynini.pyx":2690
 * FarFileMode = """typing.Literal["r", "w"]"""
 * 
 * FstLike = """typing.Union[Fst, str]"""             # <<<<<<<<<<<<<<
 * TokenType = """typing.Union[SymbolTableView, typing.Literal["byte", "utf8"]]"""
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FstLike, __pyx_kp_u_typing_Union_Fst_str) < 0) __PYX_ERR(0, 2690, __pyx_L1_error)

  /* "_pynini.pyx":2691
 * 
 * FstLike = """typing.Union[Fst, str]"""
 * TokenType = """typing.Union[SymbolTableView, typing.Literal["byte", "utf8"]]"""             # <<<<<<<<<<<<<<
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TokenType, __pyx_kp_u_typing_Union_SymbolTableView_typ) < 0) __PYX_ERR(0, 2691, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_PdtParentheses(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_57__pyx_unpickle_PdtParentheses, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_PdtParentheses, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_PdtParentheses__set_state(<PdtParentheses> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PdtParentheses__set_state(PdtParentheses __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._parens = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_59__pyx_unpickle_MPdtParentheses, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_MPdtParentheses, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Far(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7_pynini_61__pyx_unpickle_Far, NULL, __pyx_n_s_pynini); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Far, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_pynini.pyx":1
 * #cython: c_string_encoding=utf8, c_string_type=unicode, language_level=3, nonecheck=True             # <<<<<<<<<<<<<<
 * # Copyright 2016-2020 Google LLC
 * #
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /*--- 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);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init _pynini", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init _pynini");
  }
  __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);
}

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

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((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

/* 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 (__Pyx_PyFastCFunction_Check(func)) {
            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

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

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

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

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

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

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

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

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

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#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;
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyString_CheckExact(s))) {
        PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
        Py_DECREF(s);
        return result;
    }
    #endif
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
        _PyUnicodeWriter_Init(&writer, 0);
#else
        _PyUnicodeWriter_Init(&writer);
#endif
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
        _PyUnicodeWriter_Init(&writer, 0);
#else
        _PyUnicodeWriter_Init(&writer);
#endif
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#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
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#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;
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

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

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

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

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* CallNextTpDealloc */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_dealloc != current_tp_dealloc)
        type = type->tp_base;
    while (type && type->tp_dealloc == current_tp_dealloc)
        type = type->tp_base;
    if (type)
        type->tp_dealloc(obj);
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* PyObjectGetAttrStrNoError */
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

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

/* GetNameInClass */
static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
    PyObject *result;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result) {
        result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
    }
    return result;
}

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

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    } 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 (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_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 (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const char neg_one = (char) -1, const_zero = (char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= 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(char),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const char neg_one = (char) -1, const_zero = (char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) 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 (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, 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 (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, 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
            char 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 (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int32_t) val;
        }
    } 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 (int32_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) {
                            return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) {
                            return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) {
                            return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int32_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int32_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int32_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int32_t val;
            PyObject *v = __Pyx_PyNumber_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 (int32_t) -1;
        }
    } else {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyInt_As_int32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int32_t");
    return (int32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int32_t");
    return (int32_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } 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 size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) 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 (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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 (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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
            size_t 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 (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } 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

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

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, 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 = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, 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 = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

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

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

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